View Code of Problem 88

#include <stdio.h>

int main()
{
	int a,b,c,d,e,f,x,y;
	int n=0;
	int q[4]={0,5,3,1};
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
	n=f+e+d+(c+3)/4;//(c+3)/4是为了多出4的余数也要占一个箱子
	x=5*d+q[c%4];
	if(b>x)
	{
		n+=(b-x+17)/18;
	}
	y=36*n-36*f-25*e-16*d-9*c-4*b;
	if(a>y)
	{
		n+=(a-y+35)/36;
	}
	printf("%d\n",n);
	return 0;
}

Double click to view unformatted code.


Back to problem 88