結果

問題 No.2707 Bag of Words Encryption
ユーザー tentententen
提出日時 2024-04-01 15:34:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 1,377 bytes
コンパイル時間 2,562 ms
コンパイル使用メモリ 78,828 KB
実行使用メモリ 55,296 KB
最終ジャッジ日時 2024-04-01 15:34:58
合計ジャッジ時間 4,328 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
53,992 KB
testcase_01 AC 54 ms
54,000 KB
testcase_02 AC 93 ms
55,136 KB
testcase_03 AC 59 ms
53,980 KB
testcase_04 AC 92 ms
55,280 KB
testcase_05 AC 67 ms
54,368 KB
testcase_06 AC 91 ms
55,268 KB
testcase_07 AC 90 ms
55,276 KB
testcase_08 AC 88 ms
55,276 KB
testcase_09 AC 89 ms
55,276 KB
testcase_10 AC 89 ms
55,248 KB
testcase_11 AC 89 ms
55,260 KB
testcase_12 AC 89 ms
55,276 KB
testcase_13 AC 101 ms
55,296 KB
testcase_14 AC 90 ms
55,264 KB
testcase_15 AC 90 ms
55,280 KB
testcase_16 AC 89 ms
55,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        int[] counts = new int[26];
        for (char c : sc.next().toCharArray()) {
            counts[c - 'A']++;
        }
        StringBuilder sb = new StringBuilder();
        for (int x : counts) {
            sb.append(x);
        }
        System.out.println(sb);
    }
}
class Scanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}
0