Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

刚好到顶和刚好滑到底都不算。。。

Posted by KatrineYang at 2017-01-19 04:18:19 on Problem 1563
不过从测试样例就可以de出来,不算太恶心
#include <iostream>

using namespace std;

int main() {
	double H,U,D,F;
	while(1){
		cin >> H >> U >> D >> F;
		if(H==0) break;
		F = U * F / 100;
		double h = 0.0;
		for(int i = 0; ; i++){
			h += (U - F * i > 0) ? (U - F * i) : 0;
			if(h > H){
				cout << "success on day " << (i+1) << endl;
				break;
			}
			h -= D;
			if(h < 0){
				cout << "failure on day " << (i+1) << endl;
				break;
			}
		}
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator