1 #include<stdio.h> 2 3 int main() 4 { 5 float day , ih , dc,H ,U , D, F,sliding; 6 while(scanf("%f%f%f%f",&H,&U,&D,&F) && H){ 7 day = 1 ; 8 ih = 0 ; 9 dc = U; 10 sliding = U * F /100 ; 11 while(1) 12 { 13 ih += dc ; 14 if(ih>H){printf("success on day %.0f ",day) ; break;} 15 ih -= D ; 16 if(ih< 0){printf("failure on day %.0f ",day) ; break;} 17 dc-= sliding ; 18 if( dc < 0 ) dc = 0 ; 19 day++; 20 } 21 } 22 return 0 ; 23 }