結果

問題 No.69 文字を自由に並び替え
ユーザー shinwisteriashinwisteria
提出日時 2017-03-18 21:36:21
言語 Java19
(openjdk 21)
結果
AC  
実行時間 122 ms / 5,000 ms
コード長 498 bytes
コンパイル時間 4,075 ms
コンパイル使用メモリ 72,908 KB
実行使用メモリ 39,988 KB
最終ジャッジ日時 2023-08-20 23:37:18
合計ジャッジ時間 7,298 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
39,608 KB
testcase_01 AC 122 ms
39,220 KB
testcase_02 AC 114 ms
39,344 KB
testcase_03 AC 115 ms
39,096 KB
testcase_04 AC 115 ms
39,448 KB
testcase_05 AC 117 ms
39,216 KB
testcase_06 AC 117 ms
39,408 KB
testcase_07 AC 116 ms
39,348 KB
testcase_08 AC 120 ms
39,448 KB
testcase_09 AC 117 ms
39,832 KB
testcase_10 AC 114 ms
39,392 KB
testcase_11 AC 113 ms
39,356 KB
testcase_12 AC 121 ms
39,988 KB
testcase_13 AC 119 ms
39,492 KB
testcase_14 AC 115 ms
39,516 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());
		int length = B.length();
		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 == length){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}
0