View Code of Problem 88

#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c, d, e, f;
	scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
	int count = 0;//箱子数
	int v1, v2;//剩余1*1和2*2的数目
	count = d + e + f + ceil(c*1.0 / 4);
	int x[4] = { 0,5,3,1 };//放完3*3还剩下2*2的个数
	v2 = 5 * d + x[c % 4];
	if (b > v2) {
		count += ceil(b*1.0 / 9);
	}
	v1 = (count - f) * 36 - 25 * e - 16 * d - 9 * c - 4 * b;
	if (a > v1) {
		count += ceil(a*1.0 / 36);
	}
	printf("%d\n", count);

	return 0;
}

Double click to view unformatted code.


Back to problem 88