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 19871026 at 2009-08-08 10:09:42 on Problem 1017
首先是用6*6的装6*6的,然后用6*6的装5*5的再将剩余的空间装1*1的,再用6*6装4*4的,剩余的空间先装2*2的如果还有空间剩余再装1*1.在6*6装3*3是重点,显示看装三个个数,如果装的是4个那么没有空间剩余,如果装的三个3*3的那么可以装1个2*2的和5个1*1的,如果装的是两个3*3的那么可以装2*2的3个和1*1的6个,还有3*3的1个的时候可以装2*2的五个其他的全装1*1的!
#include <iostream>
using namespace std;
int main()
{
	int a[10],i,j,sum,m,left1,left2;
	int u[4]={0,5,3,1};
	while (1)
	{
		sum=0;
		for(i=1;i<=6;i++)
		{
			cin>>a[i];
			sum+=a[i];
		}
		if(sum==0)
			break;
		m=a[6]+a[5]+a[4]+(3+a[3])/4;
		left2=a[4]*5+u[a[3]%4];
		if(a[2]>left2)
			m+=(a[2]-left2+8)/9;
		left1=m*36-a[6]*36-a[5]*25-a[4]*16-a[3]*9-a[2]*4;
		if(a[1]>left1)
			m+=(a[1]-left1+35)/36;
		cout<<m<<endl;
	}
	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