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

有哪位大哥能帮我看一下,怎么老memory exceed limit?!!!

Posted by akeyong at 2004-01-11 11:07:14 on Problem 1017
// 1017.cpp : Defines the entry point for the console application.
//


#include"iostream.h"

void main()
{
	int a[6],b[300],i=0,j=0,k,max=0;
	while((cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>a[5])
		 &&((a[0]!=0)||(a[1]!=0)||(a[2]!=0)||(a[3]!=0)
		 ||(a[4]!=0)||(a[5]!=0)))
	{
		max+=(a[5]+a[4]+a[3]+a[2]/4);
		a[0]-=11*a[4];
		k=5*a[3];
        if(a[1]>k)
			a[1]-=k;
		else
		{
			if(a[0]>0)
			   a[0]-=4*(k-a[1]);
			a[1]=0;
		}
	    if((k=a[2]%4)!=0)
         if(a[1]>7-2*k)
		 {
				max+=(k!=0?1:0);
				a[1]-=(7-2*k);
				a[0]-=(8-k) ; 
		 }
		 else
		 {
				max+=(k!=0?1:0);
				if(a[0]>0)
			    	a[0]-=(36-9*k);
				a[1]=0;
		 }
		k=a[1]%9;
		if(a[1]>0)
		{
		  max+=(a[1]/9+k/9);
		  if(a[0]>0)
		    a[0]-=(36-4*k);
		}
        if(a[0]>0)
		  max+=(a[0]/36+(a[0]%36)/36);
		b[j++]=max;
        max=0;
	}
	for(i=0;i<j;i++)
    	cout<<b[i]<<endl;
      
}
  

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