結果

問題 No.69 文字を自由に並び替え
ユーザー shinwisteriashinwisteria
提出日時 2017-03-18 21:33:54
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 475 bytes
コンパイル時間 3,526 ms
コンパイル使用メモリ 72,440 KB
実行使用メモリ 56,180 KB
最終ジャッジ日時 2023-09-09 21:13:16
合計ジャッジ時間 6,257 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 123 ms
55,792 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 122 ms
55,784 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 121 ms
55,992 KB
testcase_10 AC 123 ms
55,580 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 127 ms
55,560 KB
testcase_14 AC 123 ms
53,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Narabikae {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		char[] A = s.nextLine().toCharArray();
		StringBuilder B = new StringBuilder(s.nextLine());
		s.close();
		int n = 0;
		for(char c : A){
			int t = B.indexOf(Character.toString(c));
			if(t >= 0){
				n++;
				B.deleteCharAt(t);
			}
		}
		
		if(n == B.length()){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}
0