#26821: C++ 簡單解


99980001 (207-07張讓宸)

School : 臺北市私立延平高級中學
ID : 128504
IP address : [203.72.178.2]
Last Login :
2024-10-22 10:35:11
c036. 00573 - The Snail -- UVa573 | From: [218.35.155.18] | Post Date : 2021-08-26 14:48

#include<bits/stdc++.h>

using namespace std;

int main(){

int s=0,f=0;

double a,b,c,d,m=0,cb;

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

cb=b;

if(a==0)break;

else {

while(m<=a or m>=0){

s+=1;

f+=1;

if(cb<0)m+=0;

else m+=cb; 

if(m>a)break; 

cb=b-b*d/100*s;

m-=c;

if(m<0)break;

 

}

if(m>a)cout<<"success on day "<<s<<endl;

else if(m<0)cout<<"failure on day "<<f<<endl;

 

}

s=0;f=0;m=0;

}

}

 
ZeroJudge Forum