2024年12月1日
代码如下,可以通过所有测试点
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int max=0,value;
for(int i =1;i<8;i++){
value= sc.nextInt()+sc.nextInt()-8;
if(value>max) max = i;
}
System.out.println(max);
}
}
但是当输入数据为下时
7 7
6 6
5 5
4 4
3 3
2 2
1 1
答案应为1,但是使用上述代码的输出为2。