标签:clu ret sky com amp html 叠加 color main
http://poj.org/problem?id=1017
//POJ_1017 //参考https://www.cnblogs.com/MashiroSky/p/5928053.html #include<stdio.h> int max(int a,int b){ if(a>b){ return a; } else{ return b; } } int main(){ int result,b[7]; while(scanf("%d %d %d %d %d %d",&b[1],&b[2],&b[3],&b[4],&b[5],&b[6])!=EOF&&(b[1]+b[2]+b[3]+b[4]+b[5]+b[6]!=0)){ result = 0; result += b[6]; result += b[5]; b[1] = max(0,b[1]-11*b[5]);//用1号方块把5号方块剩余部分填满 result += b[4]; if(b[2]>b[4]*5){//2号填5号 b[2] -= b[4]*5; } else{ b[1] = max(0,b[1]-4*(b[4]*5-b[2]));//用1号填满4,2号剩下的部分 b[2] = 0; } result += (b[3]+3)/4;//b[3]1~4个一箱,往后叠加 b[3] %= 4; if(b[3]){ if(b[2]>=7-2*b[3]){//3号箱i个可以装j个2号箱,i={1,2,3} j={5,3,1} b[2] -= 7-2*b[3]; b[1] = max(0,b[1]-(8-b[3]));//用i个1号箱填满j个3号箱剩余部分j={1,2,3},i={7,6,5} } else{ b[1] = max(0,b[1]-(36-9*b[3]-4*b[2])); b[2] = 0; } } result += (b[2]+8)/9; b[2] %= 9; if(b[2]){ b[1] = max(0,b[1]-(36-4*b[2])); } result += (b[1]+35)/36; printf("%d\n",result); } return 0; }
标签:clu ret sky com amp html 叠加 color main
原文地址:https://www.cnblogs.com/stevenzrx/p/11668983.html