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

贴个长长的AC代码留念。纯模拟,目前刷水最长的代码

Posted by HJWAJ at 2010-07-14 10:19:53 on Problem 1017
#include <iostream>
using namespace std;

int main()
{
	int a[6],n=0;
	for(int i=0;i<6;i++)
	    cin>>a[i];
	while(a[0]!=0 || a[1]!=0 || a[2]!=0 || a[3]!=0 || a[4]!=0 || a[5]!=0)
	{
        n+=a[5];
        
        n+=a[4];
        if(a[0]>11*a[4])a[0]=a[0]-11*a[4];
        else a[0]=0;
        
        n+=a[3];  
        if(a[1]>5*a[3])a[1]=a[1]-5*a[3];
        else 
        {
             
             if(a[0]>(20*a[3]-4*a[1]))a[0]=a[0]-(20*a[3]-4*a[1]);
             else a[0]=0;
             a[1]=0;
             
        }
        
        if(a[2]%4==0)
        {
            n=n+a[2]/4;
            if(a[1]%9==0)
            {
                n=n+a[1]/9;
                if(a[0]%36==0) n=n+a[0]/36;
                else n=n+a[0]/36+1;
            }
            else
            {
                n=n+a[1]/9+1;
                if(a[0]>(36-a[1]%9*4))
                {
                    a[0]=a[0]-(36-a[1]%9*4);
                    if(a[0]%36==0) n=n+a[0]/36;
                    else n=n+a[0]/36+1;     
                                
                } 
            }
        }
        else if(a[2]%4==1) 
        {
             n=n+a[2]/4+1;
             if(a[1]-5>0)
             {
                 a[1]-=5;
                 if(a[1]%9==0)
                 {
                     n=n+a[1]/9;
                     if(a[0]-7>0)
                     {
                         a[0]-=7;
                         if(a[0]%36==0)n=n+a[0]/36;
                         else n=n+a[0]/36+1;  
                           
                     }
                 }           
                 else
                 {
                      n=n+a[1]/9+1;
                      if(a[0]-7-(36-4*(a[1]%9))>0)
                      {
                         a[0]=a[0]-7-(36-4*(a[1]%9));
                         if(a[0]%36==0)n=n+a[0]/36;
                         else n=n+a[0]/36+1;    
                      } 
                        
                 }
             }
             else
             {
                 if(a[0]>(27-a[1]*4))
                 {
                      a[0]=a[0]-(27-a[1]*4);
                      if(a[0]%36==0)n=n+a[0]/36;
                      else n=n+a[0]/36+1;    
                             
                 }    
             }
        }
        else if(a[2]%4==2) 
        {
             n=n+a[2]/4+1;
             if(a[1]-3>0)
             {
                 a[1]-=3;
                 if(a[1]%9==0)
                 {
                     n=n+a[1]/9;
                     if(a[0]-6>0)
                     {
                         a[0]-=6;
                         if(a[0]%36==0)n=n+a[0]/36;
                         else n=n+a[0]/36+1;   
                         
                     }
                 }           
                 else
                 {
                      n=n+a[1]/9+1;
                      if(a[0]-6-(36-4*(a[1]%9))>0)
                      {
                         a[0]=a[0]-6-(36-4*(a[1]%9));
                         if(a[0]%36==0)n=n+a[0]/36;
                         else n=n+a[0]/36+1;           
                     }   
                 }
             }
             else
             {
                 if(a[0]>(18-a[1]*4))
                 {
                      a[0]=a[0]-(18-a[1]*4);
                      if(a[0]%36==0)n=n+a[0]/36;
                      else n=n+a[0]/36+1;  
                               
                 }    
             }
        }
        else if(a[2]%4==3) 
        {
             n=n+a[2]/4+1;
             if(a[1]-1>0)
             {
                 a[1]-=1;
                 if(a[1]%9==0)
                 {
                     n=n+a[1]/9;
                     if(a[0]-5>0)
                     {
                         a[0]-=5;
                         if(a[0]%36==0)n=n+a[0]/36;
                         else n=n+a[0]/36+1;  
                          
                     }
                 }           
                 else
                 {
                      n=n+a[1]/9+1;
                      if(a[0]-5-(36-4*((a[1]-1)%9))>0)
                      {
                         a[0]=a[0]-5-(36-4*((a[1]-1)%9));
                         if(a[0]%36==0)n=n+a[0]/36;
                         else n=n+a[0]/36+1;           
                     }   
                 }
             }
             else
             {
                 if(a[0]>(9-a[1]*4))
                 {
                      a[0]=a[0]-(9-a[1]*4);
                      if(a[0]%36==0)n=n+a[0]/36;
                      else n=n+a[0]/36+1;   
                       
                 }    
             }
        }
                    
        cout<<n<<endl;
        n=0;
        for(int i=0;i<6;i++)
	        cin>>a[i];          
    }
    
    
    system("pause");
    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