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 Ink213 at 2013-02-20 15:55:56 on Problem 1017
#include<cstdio>
using namespace std;
int main()
{
    int a,b,c,d,e,f;
    while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)&&(a||b||c||d||e||f))
    {
        if(11*e>=a)
            a=0;
        else
            a-=11*e;
        f+=e;
        if(5*d<b)
            b-=5*d;
        else
        {
            a-=d*36-d*16-b*4;
            b=0;
            if(a<0)
                a=0;
        }
        f+=d;
        f+=c/4;
        c-=c/4*4;
        if(c!=0)
        {
            if(c==3)
            {
                a-=(4-c)*5;
                b-=(4-c);
            }
            else if(c==2)
            {
                if(b>=3)
                {
                    b-=3;
                    a-=6;
                }
                else
                {
                    a-=(3-b)*4+6;
                    b=0;
                }
            }
            else
            {
                    if(b>=5)
                    {
                        b-=5;
                        a-=7;
                    }
                    else
                    {
                        a-=(4-b)*4+11;
                        b=0;
                    }
            }
            if(a<0)
                a=0;
            if(b<0)
                b=0;
            f++;
        }
        f+=b/9;
        b-=b/9*9;
        if(b!=0)
        {
            a-=36-b*4;
            if(a<0)
                a=0;
            f++;
        }
        f+=(a%36==0?a/36:a/36+1);
        printf("%d\n",f);
    }
    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