个人的吃雪糕求解
package com.wxf.exam.write;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.SynchronousQueue;

public class SolveSecondQuestion {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Obj> list = new ArrayList<>();
        Obj o = null;
        for (int i = 0; i < n; i++) {
            o = new Obj();
            o.highDay = sc.nextInt();
            o.one = sc.nextInt();
            o.two = sc.nextInt();
            o.three = sc.nextInt();
            list.add(o);
        }
        // for (Obj oo : list)
        // System.out.println(oo);
        for (Obj oo : list)
            isSafeDurHighDay(oo);
    }

    /**
     * 是否安全度过高温天气
    
     * @param oo
     */
    private static void isSafeDurHighDay(Obj oo) {
        // TODO Auto-generated method stub
        int one = oo.one;
        int two = oo.two;
        int three = oo.three;
        int highDay = oo.highDay;
        int count = 6;
        int i;
        int flag = 0;
//        System.out.println(oo);
        if (highDay * 6 <= one + two * 2 + three * 3) {
            // 在大的前提下,再去判断
            for (i = 1; i <= highDay; i++) {
                count = 6;
                while (count > 0 && (three > 0 || two > 0 || one > 0)) {
                    flag = 0;
                    while (count - 3 >= 0 && three > 0) {
                        count -= 3;
                        three--;
                        flag++;
                    }
                    while (count - 2 >= 0 && two > 0) {
                        count -= 2;
                        two--;
                        flag++;
                    }
                    while (count - 1 >= 0 && one > 0) {
                        count -= 1;
                        one--;
                        flag++;
                    }

                    if (flag == 0) {
                        break;
                    }
                }
                if (count > 0) {
                    System.out.println("No");
                    break;
                }
            }
            if (i > highDay)
                System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}

/**
 * @author Administrator
 *
 */
class Obj {
    public int highDay;
    public int one;
    public int two;
    public int three;

    @Override
    public String toString() {
        return "(" + highDay + "," + one + ", " + two + ", " + three + ")";
    }

}



//4 
//1 1 1 1 
//2 0 0 4 
//3 0 2 5 
//4 24 0 0