Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<array>
- #include <bits/stdc++.h>
- #include<string>
- using namespace std;
- int main ()
- {
- double h=0,u=0,d=0,f=0,k=1;
- float c,m=0;
- cin>>h>>u>>d>>f;
- while(h!=0){
- c=u*(f/100);
- m=0;
- k=0;
- while(m>=0){
- k++;
- m+=u;
- if(m<=h) {
- m-=d;
- }
- else {
- cout<<"success on day "<<k<<endl;
- break;
- }
- if(u>0) u-=c;
- else u=0;
- }
- if(m<0) cout<<"failure on day "<<k<<endl;
- cin>>h>>u>>d>>f;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement