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:我真不知道哪错了,1000个测试数据我一个个对的,还WA,服了。

Posted by qqqymx at 2010-02-04 17:22:10 on Problem 1017
In Reply To:我真不知道哪错了,1000个测试数据我一个个对的,还WA,服了。 Posted by:litter at 2009-08-28 18:25:40
> #include <iostream>
> using namespace std;
> 
> int p[7];
> int main()
> {
>     while(1)
>     {
>         cin>>p[1]>>p[2]>>p[3]>>p[4]>>p[5]>>p[6];
>         if(p[1]==0&&p[2]==0&&p[3]==0&&p[4]==0&&p[5]==0&&p[6]==0) break;
>         else
>         {
>             int ans=p[6];       
>             ans+=p[5];
>             p[1]=p[1]-p[5]*11>0? p[1]-p[5]*11:0;      
>             ans+=p[4];  
>             if(p[2]<=p[4]*5)
>             {
>                 int rest =p[4]*5-p[2];
> 				p[2]=0;
>                 p[1]=rest*4-p[1]>=0? 0:p[1]-rest*4;
>             }
>             else  p[2]=p[2]-p[4]*5;
>             ans+=(p[3]+3)/4;
> 			int mod=p[3]%4; 
>             if(mod==1)
>             {
>                   if(p[2]>=5)
>                   {
>                     p[2]-=5;
>                     p[1]=p[1]-7>0? p[1]-7:0;
>                   }
>                   else
>                   {
> 					   p[1]-(27-p[2]*4)>=0?p[1]-(27-p[2]*4):0;
> 					   p[2]=0;
>                   }
>               }
>               else if(mod==2)
>               {
>                 if(p[2]>=3)
>                 {
>                     p[2]-=3;
>                     p[1]=p[1]-6>=0?p[1]-6:0;
>                 }
>                 else
>                 {
>                    p[1]-(18-p[2]*4)>=0?p[1]-(18-p[2]*4):0;
> 				   p[2]=0;
>                 }
>               }
>               else if(mod==3)
>               {
>                   if(p[2]>=1)
>                   {
>                       p[2]-=1;
>                       p[1]=p[1]-5>=0?p[1]-5:0;
>                   }
>                   else
>                   {
>                        p[1]-(9-p[2]*4)>=0?p[1]-(9-p[2]*4):0;
>                        p[2]=0;
>                   }
>               }
>                ans+=(p[2]+8)/9;
>                if(p[2]%9==1)
> 			   {
>                       p[1]=p[1]-32>0?p[1]-32:0;
> 			   }
>                    else if(p[2]%9==2)
> 				   {
>                       p[1]=p[1]-28>0?p[1]-28:0;
> 				   }
>                   else if(p[2]%9==3)
>                   {
>                       p[1]=p[1]-24>0?p[1]-24:0;
>                   }
>                   else if(p[2]%9==4)
>                   {
>                       p[1]=p[1]-20>0? p[1]-20:0;
>                   }
>                   else if(p[2]%9==5)
>                   {
>                       p[1]=p[1]-16>0?p[1]-16:0;
>                   }
> 				  else if(p[2]%9==6)
> 				  {
> 					  p[1]=p[1]-12>0?p[1]-12:0;
> 				  }
> 				  else if(p[2]%9==7)
> 				  {
> 					  p[1]=p[1]-8>0?p[1]-8:0;
> 				  }
> 				  else if(p[2]%9==8)
> 				  {
> 					  p[1]=p[1]-4>0?p[1]-4:0;
> 				  }
> 			  ans+=(p[1]+35)/36;
>               cout<<ans<<endl;
>         }
>     }
>     return 0;
> }

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