๋ฐ์ํ
ํ์ด์ฝ๋
import java.util.*;
import java.io.FileInputStream;
class Solution
{
public static void main(String args[]) throws Exception
{
Scanner sc = new Scanner(System.in);
int T;
T=sc.nextInt();
/*
์ฌ๋ฌ ๊ฐ์ ํ
์คํธ ์ผ์ด์ค๊ฐ ์ฃผ์ด์ง๋ฏ๋ก, ๊ฐ๊ฐ์ ์ฒ๋ฆฌํฉ๋๋ค.
*/
for(int test_case = 1; test_case <= T; test_case++)
{ int testNum = sc.nextInt();
//System.out.println(testNum + "๋ฒ์งธ");
int[] scoreArr = new int[1000];
int[] scoreCountArr = new int[101]; //0๋ ํฌํจํด์ผํจ
//์ ์ ๋ฑ์ฅํ์ ์
๋ ฅ
for(int i=0; i<1000; i++){
int score = sc.nextInt();
scoreArr[i] = score;
scoreCountArr[score] = scoreCountArr[score] +1;
}
//์ ์ ๋ฑ์ฅํ์์ ์ต๋๊ฐ ๊ตฌํ๊ธฐ
int max = 0;
//์ ์ ๋ฑ์ฅํ์์ ์ต๋๊ฐ์ ํด๋นํ๋ ์ซ์ ๊ฐ์ ธ์ค๊ธฐ
int result = 0;
for(int i=100; i>=0; i--){
if(scoreCountArr[i] > max){
max = scoreCountArr[i];
result = i;
}
}
System.out.println("#" + testNum + " " + result);
}
}
}
๋ฐ์ํ
'๐ฏ Coding Test' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค] 10828 ์คํ (๋ฐฐ์ด, LinkedList๋ก ๊ตฌํํด๋ณด๊ธฐ) (0) | 2022.02.10 |
---|---|
[SWEA] 1206. [S/W ๋ฌธ์ ํด๊ฒฐ ๊ธฐ๋ณธ] 1์ผ์ฐจ - View (0) | 2022.02.10 |
๋ฐฑ์ค 1026๋ฒ : ๋ณด๋ฌผ (0) | 2021.10.27 |
๋ฐฑ์ค 1946๋ฒ : ์ ์ ์ฌ์ (0) | 2021.10.26 |
๋ฐฑ์ค 2217๋ฒ : ๋กํ (์๊ฐ์ด๊ณผ ํด๊ฒฐ๊ณผ์ ) (0) | 2021.10.25 |