結果

問題 No.69 文字を自由に並び替え
ユーザー papipenpapipen
提出日時 2017-03-28 01:23:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 689 bytes
コンパイル時間 2,279 ms
コンパイル使用メモリ 74,416 KB
実行使用メモリ 40,172 KB
最終ジャッジ日時 2023-08-20 23:37:52
合計ジャッジ時間 4,947 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
39,348 KB
testcase_01 AC 111 ms
39,640 KB
testcase_02 AC 113 ms
39,264 KB
testcase_03 AC 112 ms
39,220 KB
testcase_04 AC 115 ms
39,948 KB
testcase_05 AC 114 ms
39,296 KB
testcase_06 AC 113 ms
39,376 KB
testcase_07 AC 116 ms
40,076 KB
testcase_08 AC 115 ms
39,780 KB
testcase_09 AC 117 ms
39,712 KB
testcase_10 AC 116 ms
40,172 KB
testcase_11 AC 118 ms
39,712 KB
testcase_12 AC 116 ms
39,236 KB
testcase_13 AC 115 ms
39,276 KB
testcase_14 AC 115 ms
39,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class mojinarabi{
	public static void main(String args[]){
		Scanner s = new Scanner(System.in);
		String a = s.next();
		String b = s.next();
		char A[] = a.toCharArray();
		char B[] = b.toCharArray();
		
		ArrayList<String> arrayA = new ArrayList<String>();
		ArrayList<String> arrayB = new ArrayList<String>();
		for(int i = 0; i < A.length; i++){
			arrayA.add(String.valueOf(A[i]));
			arrayB.add(String.valueOf(B[i]));
		}
		Collections.sort(arrayA);
		Collections.sort(arrayB);
		
		for(int i = 0; i < arrayA.size(); i++){
			if(!(arrayA.get(i).equals(arrayB.get(i)))){
				System.out.println("NO");
				System.exit(0);
			}
		}
		System.out.println("YES");
	}
}
0