View Code of Problem 88

#include<stdio.h>
#include<math.h>
#include<cstring>
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d,e,f;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF){
		int sum=0,n=0,m=0;
		if(a==0&&b==0&&c==0&&d==0&&e==0&f==0)return 0;
		sum+=f+e+d+(c+3)/4;
		if(c%4==3){
			m=m+5;
		}
		if(c%4==2){
			m+=3;
		}
		if(c%4==1){
			m=m+1;
		}
		m=m+5*d;
		if(m<b){
			int k=b-m;
			double n=k/9;
			int n1=k/9;
			if(n==n1)sum=sum+n;
			else
			sum=sum+n+1;
		}
		n=36*sum-36*f-25*e-16*d-9*c-4*b;
		if(n<a){
			int k=a-m;
			double n=k/36;
			int n1=k/36;
			if(n==n1)sum=sum+n;
			else
			sum=sum+n+1;
		} 
		cout<<sum<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 88