Lazy frog
发布日期:2021-05-10 10:56:57 浏览次数:23 分类:原创文章

本文共 851 字,大约阅读时间需要 2 分钟。

Lazy frog

There was once a frog who live in the depth of the unknown wells,
one day he wanted to walk out.But he was lazy, climb three meters daytime and night will fall two meters.

If given the well depth x, you calculate the number of days after the frog from the well out.

Input

Input a series of test data. Each line including a integer x (x<=1000).

Output

Output there is an integer representing the number of days required.

Sample Input

     3    2   4 

Sample Output

     1    1   2 
#include <stdio.h>int main(void){       int h;    while(scanf("%d", &h) == 1)    {           int m = 0, i;        for(i = 0; m < h; )        {               m += 3;            i++;            if(m >= h)            {                   break;            }            else            {                   m -= 2;            }        }        printf("%d\n", i);    }}
上一篇:三原色
下一篇:Marshal's confusion

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2025年04月10日 12时29分25秒