結果
問題 | No.24 数当てゲーム |
ユーザー | syu |
提出日時 | 2020-08-26 21:20:31 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 119 ms / 5,000 ms |
コード長 | 1,349 bytes |
コンパイル時間 | 2,162 ms |
コンパイル使用メモリ | 75,260 KB |
実行使用メモリ | 56,208 KB |
最終ジャッジ日時 | 2023-08-07 09:53:18 |
合計ジャッジ時間 | 4,020 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 115 ms
56,012 KB |
testcase_01 | AC | 117 ms
55,872 KB |
testcase_02 | AC | 117 ms
55,832 KB |
testcase_03 | AC | 118 ms
55,876 KB |
testcase_04 | AC | 117 ms
56,068 KB |
testcase_05 | AC | 116 ms
56,208 KB |
testcase_06 | AC | 118 ms
55,888 KB |
testcase_07 | AC | 119 ms
55,628 KB |
testcase_08 | AC | 118 ms
56,108 KB |
testcase_09 | AC | 116 ms
56,140 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); Map<Integer,Integer> map=new HashMap<>(); for(int i=0;i<10;i++){ map.put(i,0); } for(int i=0;i<n;i++){ int num_1=sc.nextInt(); int num_2=sc.nextInt(); int num_3=sc.nextInt(); int num_4=sc.nextInt(); int[] numbers={num_1,num_2,num_3,num_4}; String result=sc.next(); if(result.equals("NO")){ for(int number:numbers){ int value=map.get(number)-1; map.put(number,value); } }else{ for(int number:numbers){ int value=map.get(number)+1; map.put(number,value); } } } int maxValue=0; for(int key:map.keySet()){ int value=map.get(key); if(maxValue<value){ maxValue=value; } } //System.out.println(maxValue); for(int key:map.keySet()){ int value=map.get(key); if(value==maxValue){ System.out.println(key); } } } }