题目要求
题目分析
emmm,可能是我不够帅,没有完全通过测试···
示例代码
public class L1_019 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num_A = sc.nextInt();
int num_B = sc.nextInt();
int num = sc.nextInt();
int[][] arr = new int[num][4];
for(int i = 0; i < num; i++) {
for(int j = 0; j < 4; j++) {
arr[i][j] = sc.nextInt();
}
}
sc.close();
int num_a = 0, num_b = 0;
for(int i = 0; i < num; i++) {
if(arr[i][1] == arr[i][0] + arr[i][2] && arr[i][3] == arr[i][1]) {
continue;
}
if(arr[i][1] == arr[i][0] + arr[i][2]) {
num_a++;
}
if(arr[i][3] == arr[i][0] + arr[i][2]) {
num_b++;
}
if(num_a > num_A) {
System.out.println("A");
System.out.println(num_b);
break;
}
if(num_b > num_B) {
System.out.println("B");
System.out.println(num_a);
break;
}
}
}
}