Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
有哪位大哥能帮我看一下,怎么老memory exceed limit?!!!// 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator