結果

問題 No.69 文字を自由に並び替え
ユーザー yagi2yagi2
提出日時 2017-04-25 16:41:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 591 bytes
コンパイル時間 1,972 ms
コンパイル使用メモリ 71,848 KB
実行使用メモリ 56,228 KB
最終ジャッジ日時 2023-08-20 23:39:32
合計ジャッジ時間 4,571 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,152 KB
testcase_01 AC 116 ms
55,752 KB
testcase_02 AC 116 ms
55,580 KB
testcase_03 AC 117 ms
55,868 KB
testcase_04 AC 120 ms
56,228 KB
testcase_05 AC 118 ms
55,712 KB
testcase_06 AC 117 ms
55,660 KB
testcase_07 AC 118 ms
55,912 KB
testcase_08 AC 115 ms
55,616 KB
testcase_09 AC 115 ms
55,628 KB
testcase_10 AC 116 ms
55,496 KB
testcase_11 AC 115 ms
55,364 KB
testcase_12 AC 115 ms
55,324 KB
testcase_13 AC 115 ms
55,896 KB
testcase_14 AC 115 ms
55,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        HashMap<String, Integer> A = input(sc);
        HashMap<String, Integer> B = input(sc);

        System.out.println((A.equals(B))? "YES" : "NO");
    }

    private static HashMap<String, Integer> input(Scanner sc) {
        HashMap<String, Integer> res = new HashMap<>();
        for (String s : sc.next().split("")) {
            if (!res.containsKey(s)) res.put(s, 0);
            res.put(s, res.get(s) + 1);
        }

        return res;
    }
}
0