Climbing Worm

http://acm.hdu.edu.cn/showproblem.php?pid=1049

 1 #include <iostream>
 2 using namespace std;
 3 int main()
 4 {
 5     int n,u,d,s,t;
 6     while (cin >> n >> u >> d)
 7     {
 8         if (n==0)
 9             return 0;
10         else
11         {
12             s=0;
13             t=0;
14             while (s+u<n)
15             {
16                 s+=u-d;
17                 t+=2;
18             }
19             t+=1;
20             cout << t << endl;
21         }
22     }
23     return 0;
24 }
原文地址:https://www.cnblogs.com/heyonggang/p/2813189.html