AC了的
public class zhuangxiangz {
public static void main(String[] args) {
int a,b,c,d,e,f; //分别表示六中木块
int ans = 0; //需要的箱子数
int x,y; //x表示用完四个大的木块剩下 2*2的位置 y表示剩下的1*1的位置
int[] three = {0,5,3,1}; //3*3的个数除4剩下的有多少2*2的剩余位置
Scanner scan=new Scanner(System.in);
while(scan.hasNext()){
a=scan.nextInt();
b=scan.nextInt();
c=scan.nextInt();
d=scan.nextInt();
e=scan.nextInt();
f=scan.nextInt();
if(a==b && b==c && c==d && d==e && e==f ){
break;
}
ans = f+e+d+(c+3)/4;
y = d*5+ three[c%4];
if(b>y)
ans += (b-y+8)/9;
x = 36*ans-36*f-25*e-16*d-9*c-b*4;
if(a>x)
ans += (a-x+35)/36;
System.out.println(ans);
}
}
}