现在的位置: 首页 > 综合 > 正文

zoj 1494 Climbing Worm

2013年04月29日 ⁄ 综合 ⁄ 共 181字 ⁄ 字号 评论关闭
#include "iostream"
using namespace std;

int main()
{
	int n, u, d, times, temp;
	while (cin >> n >> u >> d && n)
	{
		times = temp = 0;
		while (1)
		{
			temp += u;
			times++;
			if (temp >= n)
				break;
			temp -= d;
			times++;
		}
		cout << times << endl;
	}
}

【上篇】
【下篇】

抱歉!评论已关闭.