結果

問題 No.69 文字を自由に並び替え
ユーザー ribenngeribennge
提出日時 2018-08-29 09:25:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 674 bytes
コンパイル時間 1,988 ms
コンパイル使用メモリ 71,792 KB
実行使用メモリ 56,304 KB
最終ジャッジ日時 2023-08-21 00:08:03
合計ジャッジ時間 4,684 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,792 KB
testcase_01 AC 119 ms
56,000 KB
testcase_02 AC 120 ms
55,776 KB
testcase_03 AC 120 ms
55,804 KB
testcase_04 AC 119 ms
56,044 KB
testcase_05 AC 117 ms
55,608 KB
testcase_06 AC 119 ms
55,604 KB
testcase_07 AC 117 ms
56,304 KB
testcase_08 AC 120 ms
55,708 KB
testcase_09 AC 120 ms
55,912 KB
testcase_10 AC 118 ms
55,472 KB
testcase_11 AC 120 ms
55,672 KB
testcase_12 AC 120 ms
56,184 KB
testcase_13 AC 117 ms
56,092 KB
testcase_14 AC 117 ms
55,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Arrays;

class No_69{
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		char[] arraya = new char[a.length()];
		char[] arrayb = new char[b.length()];
		int cnt = 0;
		
		for(int i = 0;i < a.length();i++){
		arraya[i] = a.charAt(i);
		arrayb[i] = b.charAt(i);
		}
		
		Arrays.sort(arraya);
		Arrays.sort(arrayb);
		
		for(int i = 0;i < a.length();i++){
		if(arraya[i] != arrayb[i]){
		break;
		}
		cnt++;
		}
		
		if(cnt == a.length()){
		System.out.println("YES");
		}else{
		System.out.println("NO");
		}
	}
}
		
0