/*
算法训练 学做菜
问题描述
涛涛立志要做新好青年,他最近在学做菜。由于技术还很生疏,他只会用鸡蛋,西红柿,鸡丁,辣酱这四种原料来做菜,我们给这四种原料标上字母A,B,C,D。
涛涛现在会做的菜有五种:
1、 西红柿炒鸡蛋 原料:AABDD
2、 酸辣鸡丁 原料:ABCD
3、 宫保鸡丁 原料:CCD
4、 水煮西红柿 原料:BBB
5、 怪味蛋 原料:AD
这天早上,开开去早市给涛涛买了一些原料回来。由于事先没有什么计划,涛涛决定,对于现存的原料,每次尽量做菜单上靠前(即编号小)的菜。
现在请你写一个程序,判断一下开开和涛涛中午能吃到哪些菜。
输入格式
共4个整数a,b,c,d。分别表示开开买的A,B,C,D这4种原料的数量。每种原料不会超过30份。
输出格式
输出5行。其中第i行表示涛涛做的第i种菜的数目。
样例输入
3
1
2
4
样例输出
1
0
1
0
1
*/
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d = sc.nextInt();
int aa = 0;
int bb = 0;
int cc = 0;
int dd = 0;
int ee = 0;
while (a - 2 >= 0 && b - 1 >= 0 && d - 2 >= 0) {
aa++;
a = a - 2;
b = b - 1;
d = d - 2;
}
while (a - 1 >= 0 && b - 1 >= 0 && c - 1 >= 0 && d - 1 >= 0) {
bb++;
a = a - 1;
b = b - 1;
c = c - 1;
d = d - 1;
}
while (c - 2 >= 0 && d - 1 >= 0) {
cc++;
c = c - 2;
d--;
}
while (b - 3 >= 0) {
dd++;
b = b - 3;
}
while (a - 1 >= 0 && d - 1 >= 0) {
ee++;
a--;
d--;
}
System.out.println(aa);
System.out.println(bb);
System.out.println(cc);
System.out.println(dd);
System.out.println(ee);
}
}