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 |
贪心的思路,对于4*4和3*3装了后的边角余料,每次都尽量用2*2的去塞满,然后再塞1*1的void deal(int x,int y) { y-=min(a[2],x)*4; a[2]-=min(a[2],x); a[1]-=min(a[1],y); } int solve() { int ans=0,tmp,x,y; ans+=a[6]; ans+=a[5],a[1]-=min(a[1],a[5]*11); ans+=a[4]; deal(a[4]*5,a[4]*20); ans+=(3+a[3])/4; tmp=a[3]%4; switch(tmp){ case 0:x=0,y=0;break; case 1:x=5,y=27;break; case 2:x=3,y=18;break; case 3:x=1,y=9;break; } deal(x,y); ans+=(8+a[2])/9; if(a[2]%9!=0)y=(9-(a[2]%9))*4; else y=0; deal(0,y); ans+=(a[1]+35)/36; return ans; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator