hdu 1049 Climbing Worm
http://acm.hdu.edu.cn/showproblem.php?pid=1049 模拟题
View Code
1 #include<iostream>
2 #include<vector>
3 #include<cstring>
4 #include<cstdlib>
5 using namespace std;
6 int main()
7 {
8 int n,u,d;
9 while(cin>>n>>u>>d)
10 {
11 if(n==0 && u==0 && d==0) break;
12 int step=1,start=0;
13
14
15 for(;start+u<n;step++)//模拟往上走
16 {
17 start=start+u-d;
18 //cout<<"start:"<<start<<endl;
19 }
20 cout<<--step*2+1<<endl;
21 }
22 return 0;
23 }