NumPy numerical calculationLazy frog

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;
 } 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值