結果

問題 No.69 文字を自由に並び替え
ユーザー dazydazy
提出日時 2016-09-05 23:18:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 853 bytes
コンパイル時間 3,269 ms
コンパイル使用メモリ 72,912 KB
実行使用メモリ 56,488 KB
最終ジャッジ日時 2023-08-20 23:27:54
合計ジャッジ時間 5,861 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
56,232 KB
testcase_01 AC 114 ms
55,488 KB
testcase_02 AC 117 ms
55,744 KB
testcase_03 AC 117 ms
56,244 KB
testcase_04 AC 115 ms
56,468 KB
testcase_05 AC 117 ms
56,348 KB
testcase_06 AC 116 ms
56,424 KB
testcase_07 AC 115 ms
56,164 KB
testcase_08 AC 114 ms
56,336 KB
testcase_09 AC 114 ms
56,488 KB
testcase_10 AC 116 ms
55,604 KB
testcase_11 AC 115 ms
55,844 KB
testcase_12 AC 115 ms
55,852 KB
testcase_13 AC 116 ms
56,224 KB
testcase_14 AC 115 ms
56,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        String X = scan.next();
        String Y = scan.next();

        if (X.length() < 1||X.length() > 10||
            Y.length() < 1||Y.length() > 10||
            X.length() != Y.length()) System.exit(1);
        char[] strX = X.toCharArray();
        char[] strY = Y.toCharArray();
        for (int i = 0; i < X.length(); i++) {
            if (Character.isUpperCase(strX[i])||Character.isUpperCase(strY[i])) System.exit(1);
        }

        Arrays.sort(strX);
        Arrays.sort(strY);
        for (int i = 0; i < X.length(); i++) {
            if (strX[i]!=strY[i]) {
                System.out.println("NO");
                System.exit(0);
            }
        }

        System.out.println("YES");
    }
}
0