結果

問題 No.69 文字を自由に並び替え
ユーザー soujikisoujiki
提出日時 2015-04-29 19:51:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 603 bytes
コンパイル時間 4,658 ms
コンパイル使用メモリ 72,548 KB
実行使用メモリ 55,924 KB
最終ジャッジ日時 2023-08-20 22:49:55
合計ジャッジ時間 7,881 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,312 KB
testcase_01 AC 116 ms
55,532 KB
testcase_02 AC 119 ms
55,604 KB
testcase_03 AC 119 ms
53,648 KB
testcase_04 AC 119 ms
55,564 KB
testcase_05 AC 117 ms
55,840 KB
testcase_06 AC 117 ms
55,612 KB
testcase_07 AC 117 ms
55,688 KB
testcase_08 AC 121 ms
55,440 KB
testcase_09 AC 119 ms
55,836 KB
testcase_10 AC 121 ms
55,504 KB
testcase_11 AC 123 ms
55,304 KB
testcase_12 AC 119 ms
55,768 KB
testcase_13 AC 118 ms
55,600 KB
testcase_14 AC 119 ms
55,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Yukicoder_69{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String A = stdIn.next();
		String B = stdIn.next();
		boolean[] judg = new boolean[A.length()];
		Arrays.fill(judg,true);
		for(int i=0;i<B.length();i++){
			char ch = B.charAt(i);
			for(int j=0;j<A.length();j++){
				if(judg[j] && ch == A.charAt(j)){
					judg[j] = false;
					break;
				}
			}
		}	

		for(int i=0;i<judg.length;i++){
			if(judg[i]){
				System.out.println("NO");
				break;
			}
			if(i==judg.length-1){
				System.out.println("YES");
			}
		}
	}
}
0