結果

問題 No.69 文字を自由に並び替え
ユーザー kazapyon27kazapyon27
提出日時 2017-05-13 16:11:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 749 bytes
コンパイル時間 3,116 ms
コンパイル使用メモリ 71,676 KB
実行使用メモリ 33,824 KB
最終ジャッジ日時 2023-08-20 23:40:33
合計ジャッジ時間 4,552 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
33,368 KB
testcase_01 AC 38 ms
33,540 KB
testcase_02 AC 38 ms
33,356 KB
testcase_03 AC 38 ms
33,608 KB
testcase_04 AC 38 ms
33,820 KB
testcase_05 AC 38 ms
33,500 KB
testcase_06 AC 38 ms
33,816 KB
testcase_07 AC 40 ms
33,504 KB
testcase_08 AC 38 ms
33,492 KB
testcase_09 AC 39 ms
33,488 KB
testcase_10 AC 38 ms
33,608 KB
testcase_11 AC 39 ms
33,824 KB
testcase_12 AC 38 ms
33,360 KB
testcase_13 AC 38 ms
33,708 KB
testcase_14 AC 39 ms
33,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.Arrays;
public class No69 {
	public static void main(String[] args) {
		try(BufferedReader input = new BufferedReader(new InputStreamReader(System.in))){
			String A= input.readLine();
			String B= input.readLine();
			char H_A[] =new char[10];
			char H_B[] =new char[10];
			boolean unmatch=false;
			if(A.equals(B))
				System.out.println("YES");
			else{
				H_A=A.toCharArray();
				Arrays.sort(H_A);
				H_B=B.toCharArray();
				Arrays.sort(H_B);
				for(int i=0;i<H_A.length;i++){
					if(H_A[i]!=H_B[i]){
						unmatch=true;
						break;
					}
				}
				if(unmatch==false)
					System.out.println("YES");
				else
					System.out.println("NO");
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
0