0
点赞
收藏
分享

微信扫一扫

Lazy frog

佳简诚锄 2022-07-12 阅读 62


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);
}
}


举报

相关推荐

0 条评论