现在的位置: 首页 > 综合 > 正文

hdoj1049简单题、模拟题

2013年10月13日 ⁄ 综合 ⁄ 共 213字 ⁄ 字号 评论关闭
#include<iostream>
using namespace std;

int main(){
	int n, u, d;
	int distance;
	int time;
	while(cin>>n>>u>>d && n != 0){
		distance = n;
		time = 0;
		while(distance > 0){
			distance -= u;
			time += 1;
			if(distance > 0){
				distance += d;
				time += 1;
			}
		}
		cout<<time<<endl;
	}
}

抱歉!评论已关闭.