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 }

 

 

posted on 2012-12-11 16:36  猿人谷  阅读(222)  评论(0编辑  收藏  举报