結果

問題 No.69 文字を自由に並び替え
ユーザー dazydazy
提出日時 2016-09-05 23:18:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 853 bytes
コンパイル時間 3,287 ms
コンパイル使用メモリ 75,208 KB
実行使用メモリ 41,396 KB
最終ジャッジ日時 2024-05-08 05:14:40
合計ジャッジ時間 5,751 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
40,144 KB
testcase_01 AC 123 ms
41,388 KB
testcase_02 AC 122 ms
41,352 KB
testcase_03 AC 121 ms
41,100 KB
testcase_04 AC 125 ms
41,392 KB
testcase_05 AC 108 ms
39,940 KB
testcase_06 AC 108 ms
40,088 KB
testcase_07 AC 121 ms
40,996 KB
testcase_08 AC 113 ms
40,736 KB
testcase_09 AC 119 ms
40,832 KB
testcase_10 AC 115 ms
40,336 KB
testcase_11 AC 121 ms
41,256 KB
testcase_12 AC 123 ms
41,004 KB
testcase_13 AC 110 ms
40,320 KB
testcase_14 AC 128 ms
41,396 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