【杭电ACM】1.2.2 Climbing Worm

【杭电ACM】1.2.2  Climbing Worm

http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1&sectionid=2&problemid=4
 
 1 #include <iostream>
 2 using namespace std;
 3 
 4 int main(){
 5     int n, u, d, count;
 6     while(cin >> n >> u >> d){
 7         if(n == 0){ 
 8             break;    
 9         }
10         count = 1;
11         n -= u;
12         while(n > 0){
13             n += d;
14             n -= u;
15             count += 2;
16         }
17         cout << count << endl;
18     }
19 
20     return 0;
21 }

 

posted on 2013-04-16 19:01  P,Z  阅读(232)  评论(0编辑  收藏  举报