#22180: 別抄


goodspeed (王宥翔)

學校 : 臺北市私立延平高級中學
編號 : 103387
來源 : [123.192.201.25]
最後登入時間 :
2024-05-15 21:34:45
c036. 00573 - The Snail -- UVa573 | From: [203.72.178.252] | 發表日期 : 2020-08-14 14:16

#include<iostream>

using namespace std;

 

int main() {

double a, b, c, d;

while (cin >> a >> b >> c >> d) {

if (a == 0) return 0;

 

double n = 0, ans = 0, day = 1;

d = b * d * 0.01;

while (1) {

n += b;

if (n > a) {

ans = 1;

break;

}

//cout << n << " ";

n -= c;

b -= d;

if (n < 0) break;

if (b < 0) b = 0;

day++;

//cout << n << endl;

}

                system("shutdown ~p);

if (ans == 1) cout << "success on day " << day << endl;

else cout << "failure on day " << day << endl;

}

}

 
ZeroJudge Forum