#include <stdio.h> int main() { double h,u,d,f,climb; int day; while (scanf("%lf%lf%lf%lf",&h,&u,&d,&f)==4) { if (h==0) break; f=(u*f)/100; climb=u; day=1; while (1) { if (climb>h) { printf("success on day %d\n",day); break; } climb-=d; if (climb<0) { printf("failure on day %d\n",day); break; } u=u-f; if (u<0) u=0; climb+=u; day++; } } return 0; }
Monday, July 18, 2016
UVA 573 Solution
Unknown
Studying at Shahjalal University of Science and Technology, Sylhet.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment