結果
| 問題 |
No.24 数当てゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-15 17:59:39 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 132 ms / 5,000 ms |
| コード長 | 662 bytes |
| コンパイル時間 | 3,469 ms |
| コンパイル使用メモリ | 74,996 KB |
| 実行使用メモリ | 54,236 KB |
| 最終ジャッジ日時 | 2024-09-13 03:12:13 |
| 合計ジャッジ時間 | 5,563 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.util.Scanner;
public class No24 {
public static void main(String[] args) {
//数当てゲーム
int[] num = new int[10];
Scanner s = new Scanner(System.in);
int N = Integer.parseInt(s.nextLine());
String[] abcd = new String[N];
for(int i = 0;i < N;i++) {
abcd[i] = s.nextLine();
}
s.close();
for(String str : abcd) {
int d;
if(str.contains("NO")) {
d = -1;
}else {
d = 1;
}
for(int i = 0;i < 4;i++) {
num[Integer.parseInt(str.split(" ")[i])] += d;
}
}
int max = 0;
for(int i = 1;i < 10;i++) {
if(num[i] > num[max]) {
max = i;
}
}
System.out.println(max);
}
}