杭电OJ ACM Steps1.2.1
/*
头文件定义了标准输入/输出流对象。
包含了也自动包含了、、、和。
*/
#include<iostream>
using namespace std;
int main(){
int n,u,d;
while(cin>>n>>u>>d){
if(n==0)break;
int time;
int hight=0;
for(time=1;;time++){
if(time%2==0){
hight-=d;
}else{
hight+=u;
if(hight>=n)break;
}
}
cout<<time<<endl;
}
return 0;
}
/*
#include<iostream>
using namespace std;
int main(){
int n,u,d,t=0,s=0;//time&S
while(cin>>n>>u>>d){
if(n==0)break;
while(1){
s+=u;
t++;
if(s>=n){
cout<<t;
break;
}
s-=d;
t++;
}
t=0;
s=0;
cout<<endl;
}
}
*/
测试结果不对,但是网上都这么编。