結果

問題 No.2268 NGワード回避
ユーザー ks2mks2m
提出日時 2023-04-14 21:25:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 350 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 2,480 ms
コンパイル使用メモリ 75,176 KB
実行使用メモリ 44,932 KB
最終ジャッジ日時 2024-04-18 18:48:52
合計ジャッジ時間 13,336 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
41,424 KB
testcase_01 AC 129 ms
41,284 KB
testcase_02 AC 128 ms
41,392 KB
testcase_03 AC 130 ms
41,244 KB
testcase_04 AC 128 ms
41,488 KB
testcase_05 AC 131 ms
41,460 KB
testcase_06 AC 137 ms
41,148 KB
testcase_07 AC 131 ms
41,392 KB
testcase_08 AC 159 ms
41,296 KB
testcase_09 AC 159 ms
41,380 KB
testcase_10 AC 162 ms
41,388 KB
testcase_11 AC 162 ms
41,404 KB
testcase_12 AC 157 ms
41,280 KB
testcase_13 AC 155 ms
41,408 KB
testcase_14 AC 158 ms
41,428 KB
testcase_15 AC 157 ms
41,436 KB
testcase_16 AC 160 ms
41,392 KB
testcase_17 AC 160 ms
41,252 KB
testcase_18 AC 146 ms
41,376 KB
testcase_19 AC 161 ms
41,416 KB
testcase_20 AC 161 ms
41,588 KB
testcase_21 AC 158 ms
41,452 KB
testcase_22 AC 157 ms
41,460 KB
testcase_23 AC 162 ms
41,444 KB
testcase_24 AC 158 ms
41,324 KB
testcase_25 AC 162 ms
41,328 KB
testcase_26 AC 174 ms
41,580 KB
testcase_27 AC 165 ms
41,248 KB
testcase_28 AC 162 ms
41,436 KB
testcase_29 AC 157 ms
41,528 KB
testcase_30 AC 160 ms
41,468 KB
testcase_31 AC 157 ms
41,420 KB
testcase_32 AC 158 ms
41,456 KB
testcase_33 AC 159 ms
41,328 KB
testcase_34 AC 162 ms
41,528 KB
testcase_35 AC 156 ms
41,572 KB
testcase_36 AC 157 ms
41,352 KB
testcase_37 AC 162 ms
41,388 KB
testcase_38 AC 157 ms
41,328 KB
testcase_39 AC 161 ms
41,392 KB
testcase_40 AC 158 ms
41,240 KB
testcase_41 AC 161 ms
41,544 KB
testcase_42 AC 160 ms
41,460 KB
testcase_43 AC 160 ms
41,364 KB
testcase_44 AC 159 ms
41,240 KB
testcase_45 AC 161 ms
41,344 KB
testcase_46 AC 161 ms
41,604 KB
testcase_47 AC 345 ms
43,992 KB
testcase_48 AC 350 ms
44,896 KB
testcase_49 AC 306 ms
44,932 KB
testcase_50 AC 296 ms
44,552 KB
testcase_51 AC 330 ms
44,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Set<String> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
			set.add(sc.next());
		}
		sc.close();

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			sb.append('a');
		}
		for (int i = 0; i < n; i++) {
			String s = sb.toString();
			if (!set.contains(s)) {
				System.out.println(s);
				return;
			}
			sb.setCharAt(i, 'b');
		}
		System.out.println(sb.toString());
	}
}
0