結果

問題 No.69 文字を自由に並び替え
ユーザー ktguyktguy
提出日時 2017-07-25 19:58:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 550 bytes
コンパイル時間 2,400 ms
コンパイル使用メモリ 72,096 KB
実行使用メモリ 39,976 KB
最終ジャッジ日時 2023-08-20 23:44:47
合計ジャッジ時間 5,120 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
39,372 KB
testcase_01 AC 112 ms
39,976 KB
testcase_02 AC 112 ms
39,424 KB
testcase_03 AC 114 ms
39,424 KB
testcase_04 AC 111 ms
39,144 KB
testcase_05 AC 112 ms
39,288 KB
testcase_06 AC 111 ms
39,056 KB
testcase_07 AC 114 ms
39,212 KB
testcase_08 AC 111 ms
39,592 KB
testcase_09 AC 113 ms
39,556 KB
testcase_10 AC 109 ms
39,876 KB
testcase_11 AC 110 ms
39,508 KB
testcase_12 AC 111 ms
39,548 KB
testcase_13 AC 113 ms
39,204 KB
testcase_14 AC 113 ms
39,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Arrays;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    char[] aa = new char[a.length()];
    char[] bb = new char[b.length()];

    for(int i = 0; i<a.length(); i++) {
      aa[i] = a.charAt(i);
      bb[i] = b.charAt(i);
     }

     Arrays.sort(aa);
     Arrays.sort(bb);

    if(Arrays.equals(aa, bb)){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}
0