- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <vector>
- using namespace std;
- int main(){
- double height, climb, slid, fatigue;
- double fatig, limit;
- int day, flag;
- while(cin >> height >> climb >> slid >> fatigue){
- if(height == 0 && height == climb && climb == slid && slid == fatigue)break;
- limit = 0, day = 0, flag = 0;
- fatig = (climb * fatigue) / 100.0;
- while(1){
- limit += climb;day++;
- if(limit > height){flag = 1; break;}
- limit -= slid;
- if(limit < 0)break;
- climb -= fatig;
- if(climb <= 0)climb = 0;
- }
- if(flag)cout << "success on day " << day << endl;
- else cout << "failure on day " << day << endl;
- }
- return 0;
- }
Friday, April 24, 2015
UVa - 573 - The Snail
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment