Scanner sc = new Scanner(System.in);
T = sc.nextInt();
for(test_case = 1; test_case <= T; test_case++) {
// 이 부분에서 알고리즘 프로그램을 작성하십시오.
int sc_score_cnt = sc.nextInt();
int sc_score_select_cnt = sc.nextInt();
int[] selected_score = new int[sc_score_select_cnt];
int total = 0;
for(int i = 0; i<sc_score_cnt; i++){
int sc_score = sc.nextInt();
if(i < sc_score_select_cnt){ //카운트 개수 만큼 채워넣어야..
selected_score[i] = sc_score;
}
else{
for(int j = 0; j<sc_score_select_cnt; j++){
if(sc_score>=selected_score[j]){
selected_score[j] = sc_score;
break;
}
}
}
}
for(int i = 0; i<sc_score_select_cnt; i++){
total += selected_score[i];
}
// 이 부분에서 정답을 출력하십시오.
System.out.println("Case #" + test_case);
System.out.println(total);
0.6초라면서 그냥 꺼져버리네요 ㅠㅠ 뭐가 문제인지 알 수 잇을가요??ㅠㅠ
알고리즘이 틀림 코드 문제는 아님
ㅇㅇ 형 만약 4 2 이라고 하면 처음 2개를 배열에 집어넣고 나머지를 2개랑 비교하면서 큰 수면 바꾸자는 취지인데 왜 틀려요??