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 |
为什么老是WA呢?还有什么情况?#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; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator