ZDou201902222047819:做完之后对我的认识就是数据结构忘了、操作系统忘了、Java忘了
0 点赞 评论 收藏
分享
Pluto_Love:import java.util.Scanner; public class DoMain { public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
int[][] array = new int[T][4];
for (int i = 0; i < T; i++) {
array[i][0] = in.nextInt();
array[i][1] = in.nextInt();
array[i][2] = in.nextInt();
array[i][3] = in.nextInt();
}
foo(array);
}
public static void foo(int[][] arr) {
System.out.println(arr.length);
for (int i = 0; i < arr.length; i++) {
while (true) {
if (arr[i][0] == 0) {
System.out.println("Yes");
break;
} else if (arr[i][0] == -1) {
System.out.println("No");
break;
}
arr[i] = cal(arr[i]);
}
}
}
public static int[] cal(int[] ar) {
if (ar[3] >= 2) {
ar[3] -= 2;
ar[0] -= 1;
} else if (ar[3] == 1 && ar[2] >= 1 && ar[1] >= 1) {
ar[3] -= 1;
ar[2] -= 1;
ar[1] -= 1;
ar[0] -= 1;
} else if (ar[3] == 1 && ar[2] == 0 && ar[1] >= 3) {
ar[3] -= 1;
ar[1] -= 3;
ar[0] -= 1;
} else if (ar[3] == 0 && ar[2] >= 3) {
ar[2] -= 3;
ar[0] -= 1;
} else if (ar[3] == 0 && ar[2] == 2 && ar[1] >= 2) {
ar[2] -= 2;
ar[1] -= 2;
ar[0] -= 1;
} else if (ar[3] == 0 && ar[2] == 1 && ar[1] >= 4) {
ar[2] -= 1;
ar[1] -= 4;
ar[0] -= 1;
} else if (ar[3] == 0 && ar[2] == 0 && ar[1] >= 6) {
ar[1] -= 6;
ar[0] -= 1;
} else {
ar[0] = -1;
}
return ar;
}
}这次格式在不对就没法了
0 点赞 评论 收藏
分享
关注他的用户也关注了: