結果

問題 No.69 文字を自由に並び替え
ユーザー Flere0114Flere0114
提出日時 2016-02-10 17:06:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 687 bytes
コンパイル時間 3,107 ms
コンパイル使用メモリ 72,976 KB
実行使用メモリ 56,144 KB
最終ジャッジ日時 2023-08-20 23:14:37
合計ジャッジ時間 5,719 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,544 KB
testcase_01 AC 117 ms
56,092 KB
testcase_02 AC 114 ms
55,928 KB
testcase_03 AC 115 ms
56,076 KB
testcase_04 AC 117 ms
55,912 KB
testcase_05 AC 117 ms
55,940 KB
testcase_06 AC 117 ms
56,128 KB
testcase_07 AC 117 ms
55,396 KB
testcase_08 AC 117 ms
56,108 KB
testcase_09 AC 117 ms
55,708 KB
testcase_10 AC 117 ms
55,700 KB
testcase_11 AC 117 ms
55,560 KB
testcase_12 AC 117 ms
56,064 KB
testcase_13 AC 117 ms
55,992 KB
testcase_14 AC 118 ms
56,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No69 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String A = sc.next();
        String B = sc.next();
        int len = A.length();
        boolean[] c = new boolean[len];
        int index;

        for (int i = 0; i < len; i++) {
            for (int j = 0; j < len; j++) {
                if(A.charAt(i) == B.charAt(j) && !c[j]){
                    c[j] = true;
                    break;
                }else if(j == len - 1){
                    System.out.println("NO");
                    return;
                }
            }
        }
        System.out.println("YES");
    }
}
0