package data;
import java.util.*;
public class HuaweiTest {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String num=sc.nextLine();
int stuNum=Integer.parseInt(num.split(" ")[0]);
int actNum=Integer.parseInt(num.split(" ")[1]);
int[] scores=new int[stuNum];
for(int i=0;i
String input=sc.nextLine();
if(i==0){
String[] scoresStrArray=input.split(" ");
for(int j=0;j
scores[j]=Integer.parseInt(scoresStrArray[j]);
}
continue;
}
String[] actArray=input.split(" ");
int num1=Integer.parseInt(actArray[1]);
int num2=Integer.parseInt(actArray[2]);
if(actArray[0].equals("Q")){
int max=0;
int mmax=num1>num2?num1:num2;
int mmin=num1
for(int j=mmin-1;j
if(scores[j]>max){
max=scores[j];
}
}
System.out.println(max);
}
else if(actArray[0].equals("U")){
scores[num1-1]=num2;
}
}
sc.close();
}
}
您的代码已保存
答案错误:您提交的程序没有通过所有的测试用例
case通过率为10.00%
用例:
9 10
28 49 11 35 40 17 57 4 6
Q 9 9
U 9 79
Q 9 5
Q 4 8
U 2 27
U 8 40
U 4 77
U 7 71
U 4 44
U 8 51
对应输出应该为:
6
79
57
你的输出为:
空.请检查一下你的代码,有没有循环输入处理多个case