結果

問題 No.2153 何コーダーが何人?
ユーザー tentententen
提出日時 2022-12-26 09:05:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 1,611 bytes
コンパイル時間 2,815 ms
コンパイル使用メモリ 87,552 KB
実行使用メモリ 52,852 KB
最終ジャッジ日時 2024-04-30 19:29:35
合計ジャッジ時間 6,168 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
51,008 KB
testcase_01 AC 96 ms
51,640 KB
testcase_02 AC 102 ms
51,804 KB
testcase_03 AC 118 ms
52,172 KB
testcase_04 AC 112 ms
52,040 KB
testcase_05 AC 105 ms
51,952 KB
testcase_06 AC 122 ms
52,332 KB
testcase_07 AC 111 ms
52,184 KB
testcase_08 AC 105 ms
52,060 KB
testcase_09 AC 136 ms
52,824 KB
testcase_10 AC 101 ms
51,904 KB
testcase_11 AC 143 ms
52,852 KB
testcase_12 AC 104 ms
52,036 KB
testcase_13 AC 115 ms
52,112 KB
testcase_14 AC 104 ms
51,908 KB
testcase_15 AC 102 ms
51,772 KB
testcase_16 AC 121 ms
52,264 KB
testcase_17 AC 124 ms
51,988 KB
testcase_18 AC 123 ms
52,616 KB
testcase_19 AC 70 ms
50,944 KB
testcase_20 AC 70 ms
51,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        HashMap<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(sc.next(), sc.nextInt());
        }
        int[] counts = new int[8];
        for (int x : map.values()) {
            counts[x]++;
        }
        System.out.println(Utilities.arrayToLineString(counts));
    }
}
class Utilities {
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0