NumPy numerical calculationLazy frog
- Time Limit: 1000 MS Memory Limit: 65536 K
NumPy数值计算Description
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()
{
int x;
int day=0;
scanf("%d",&x);
while(x>0)
{
x=x-3;
day++;
if(x>0)
{
x=x+2;
}
}
printf("%d",day);
return 0;
}