Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:为什么老是WA呢?还有什么情况?In Reply To:为什么老是WA呢?还有什么情况? Posted by:longlong6789 at 2008-07-21 18:50:18 > #include<stdio.h> > int main() > { > int day; > double h,d,uu,u,f,s; > while(scanf("%lf %lf %lf %lf",&h,&uu,&d,&f)&&h!=0) > { > day=1; > s=0; > f=uu*(f/100); > u=uu; > while(1) > { > s=s+u; > if(s>h){printf("success on day %d\n",day);break;} > s=s-d; > if(s<0){printf("failure on day %d\n",day);break;} > day++; > if(s==0){printf("failure on day %d\n",day);break;} > u=u-f; > if(u<0)//极度疲惫的情况…… > { > u=uu; > s=s-d; > if(s<0){printf("failure on day %d\n",day);break;} > day++; > if(s==0){printf("failure on day %d\n",day);break;} > } > } > } > return 0; > } 我试了一下5 3 1 50你的代码就过不了,正确答案应该是“failure on day 5". Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator