Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- double h,u,d,f,a,b,c,e,g,j,k,ih,th,hac,has,dc,ff;
- while(scanf("%lf %lf %lf %lf",&h,&u,&d,&f)==4)
- {
- if(h==0)
- break;
- ff=(u*f)/100;
- int day=0,flag=0;
- th=0;
- while(1)
- {
- day++;
- th+=u;
- u-=ff;
- if(u<0)
- u=0;
- if(th>h){
- cout<<"success on day "<<day<<endl;
- break;}
- th-=d;
- if(th<0){
- cout<<"failure on day "<<day<<endl;
- break;}
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement