Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:为什么老是WA呢?还有什么情况?

Posted by hugett at 2009-01-13 21:28:00 on Problem 1563
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator