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:这算法太帅了;

Posted by 41151095 at 2013-06-13 17:12:10 on Problem 1017
In Reply To:Re:这算法太帅了; Posted by:tiaoer at 2012-04-06 23:51:48
> #include<stdio.h>
> int main()
> {
> 	int n,a,b,c,d,e,f,x,y;
> 	int u[4]={0,5,3,1};
> 	while(1)
> 	{
> 		scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
> 		if(a==0&&b==0&&c==0&&d==0&&e==0&&f==0)
> 			break;
> 		n=d+e+f+(c+3)/4;//懂了
> 		y=5*d+u[c%4];//在已有n个的情况下,能装下y个2*2的
> 		if(b>y)
> 			n+=(b-y+8)/9;//把多的2*2的弄进来
> 		x=36*n-36*f-25*e-16*d-9*c-4*b;
> 		if(a>x)
> 			n+=(a-x+35)/36;//把1*1的弄进来
> 		printf("%d\n",n);
> 	}
> 	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