結果
| 問題 | No.24 数当てゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-16 21:31:11 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 58 ms / 5,000 ms |
| コード長 | 1,037 bytes |
| コンパイル時間 | 2,581 ms |
| コンパイル使用メモリ | 74,444 KB |
| 実行使用メモリ | 50,360 KB |
| 最終ジャッジ日時 | 2024-06-27 04:04:57 |
| 合計ジャッジ時間 | 3,365 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] arr = new int[10];
while (n-- > 0) {
String[] input = br.readLine().split(" ");
if (input[4].equals("YES")) {
for (int i = 0; i < 4; i++) {
arr[Integer.parseInt(input[i])]++;
}
} else if (input[4].equals("NO")) {
for (int i = 0; i < 4; i++) {
arr[Integer.parseInt(input[i])]--;
}
}
}
int maxIndex = 0;
int maxValue = arr[0];
for (int i = 1; i < 10; i++) {
if (maxValue < arr[i]) {
maxIndex = i;
maxValue = arr[i];
}
}
System.out.println(maxIndex);
}
}