| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
刚好到顶和刚好滑到底都不算。。。不过从测试样例就可以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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator