View Code of Problem 88

#include<iostream>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<cstring>
#include<string>
using namespace std;
int main() {
	int box[6],num=0;
	for(int i=0; i<6; i++)
		cin>>box[i];
	while(box[5]>0) {
		box[5]--;
		num++;
	}
	while(box[4]>0) {
		box[4]--;
		if(box[0]>0)
		box[0]-=11;
		num++;
	}
	while(box[3]>0) {
		box[3]--;
		if(box[1]>=5)
		box[1]-=5;
		else if(box[0]>0)
		{
			box[1]=0;
			box[0]-=4*(5-box[1]);
		}
		num++;
	}
	while(box[2]>0) {
		
		if(box[2]>=4)
		box[2]-=4;
		else
		{
			box[2]=0;
			if(4-box[2]==1)
			{
				box[1]-=1;
				box[0]-=5;
			}
				if(4-box[2]==2)
			{
				box[1]-=3;
				box[0]-=6;
			}
				if(4-box[2]==3)
			{
				box[1]-=5;
				box[0]-=7;
			}
		
		}
		num++;
	}
	while(box[1]>0) {
		if(box[1]>=9)
		box[1]-=9;
		else
		{
			box[1]=0;
			box[0]-=4*(9-box[1]);
		}
		num++;
	}
	while(box[0]>0) {
		box[0]-=36;
		num++;
	}
cout<<num;
	return 0;

}

Double click to view unformatted code.


Back to problem 88