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

那位好心人帮我看下错哪里了,谢啦!!!

Posted by 05122868 at 2008-04-15 21:10:37 on Problem 1017
#include <iostream>

using namespace std;

int main()
{
    
    while(true)
    {
        int s[7];
        int n=0;
        for(int i=1;i<=6;i++)
        {
            cin>>s[i];
            n+=s[i];
        }
        if(n==0) return 1;    
        int sum=s[4]+s[5]+s[6]+s[3]/4;
        s[1]=s[1]-11*s[5];
        s[2]=s[2]-5*s[4];
        s[3]=s[3]%4;
        switch(s[3])
        {
            case 1:s[1]-=7;s[2]-=5;sum+=1;break;
            case 2:s[1]-=6;s[2]-=3;sum+=1;break;
            case 3:s[1]-=4;s[2]-=1;sum+=1;break;
        }
        if(s[1]<=0 && s[2]>0)
        {
            if(4*s[2]%36==0)
            sum+=4*s[2]/36;
            else sum+=(4*s[2]/36+1);
        }
        else if(s[1]>0 && s[2]>=0)
        {
            int m=(s[1]+4*s[2]);
            if(m%36==0)
            sum+=m/36;
            else sum+=(m/36+1);
        }
        else if(s[1]>0 && s[2]<0)
        {
            int m=s[1]+4*s[2];
            if(m>0 && m<=36)
            sum+=1;
            if(m>0 && m>36)
            {
                if(m%36==0)
                sum+=m/36;
                else
                sum+=(m/36+1);
            }
        }
        cout<<sum<<endl;
    }
    return 1;
}                

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