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 0809114213 at 2010-08-22 22:34:43 on Problem 1017
#include<stdio.h>
#include<string.h>

int BY[8],i,sum,n,WKO1,WKO2;

int ri(void);
void ying(void);
int xiaolu(void);

void main(void)
{
	while(1)
	{
		sum=0;n=0;WKO1=0;WKO2=0;
		for(i=1;i<=6;i++)
		{
			scanf("%d",BY+i);
			sum+=BY[i];
		}
		if(!sum)
			break;
		printf("%d\n",ri());
	}
}

int ri(void)
{
	n=BY[6]+BY[5]+BY[4];
	WKO1=11*BY[5];
	WKO2=5*BY[4];
	ying();
	return xiaolu();
}

void ying(void)
{
	if(BY[3])
	switch(BY[3]%4)
	{
	case 0:
		{
			n+=BY[3]/4;
			break;
		}
    case 3:
		{
			n+=BY[3]/4+1; WKO1+=5; WKO2+=1;
			break;
		}
    case 2:
		{
			n+=BY[3]/4+1; WKO1+=6; WKO2+=3;
			break;
		}
    case 1:
		{
			n+=BY[3]/4+1; WKO1+=7; WKO2+=5;
			break;
		}
	}
}

int xiaolu(void)
{
	if(BY[2]<=WKO2)
	{
		WKO1+=(WKO2-BY[2])*4;
	}
	else
	{
		if((BY[2]-WKO2)%9)
		        n+=(BY[2]-WKO2)/9+1;
		else
			n+=(BY[2]-WKO2)/9;
		WKO1+=(9-(BY[2]-WKO2)%9)*4;
	}
	if(BY[1]<=WKO1)
		return n;
	else
		if((BY[1]-WKO1)%36)
		        return n+(BY[1]-WKO1)/36+1;
		else
			return n+(BY[1]-WKO1)/36;
}

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