搜狐_装箱子

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); 
		}
	}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值