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 Johnson_Yip at 2015-02-12 02:44:27 on Problem 1017
我英语不好我骄傲, 一个晚上就花在研究Discuss的样例里...
前车之鉴后车之师哪, 千万不要像我一样看错了...
虽然我觉得也只有我一个逗比会看错题目了
不过还好, 就是改几个数据就好了...

那还是贴一下AC代码好了, 貌似我和网上的思路不太一样...
另外, 原谅我放荡不羁的压代码风格

#include<cstdio>
using namespace std;

int a,b,c,d,e,f,x;     //abcdef分别为123456的数量, x为需要包装盒的个数
int u[4]={0,5,3,1};    //u[i]指的是3的多出i个时, 最多可以填充多少个2
int v[4]={0,7,6,5};    //v[i]指的是3的多出i个时, 填完2后还可以填多少1

int main(){
	while(~scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)){
		if(!a&&!b&&!c&&!d&&!e&&!f)break;
		x=f+e+d+(c+3)/4;
		if((b-=5*d+u[c&3])>0)x+=(b+8)/9,b=(b%9-9)%9;
		if((a-=11*e+v[c&3]-b*4)>0)x+=(a+35)/36;
		printf("%d\n",x);
	}
	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