結果

問題 No.2373 wa, wo, n
ユーザー ks2mks2m
提出日時 2023-07-07 21:37:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 4,146 ms
コンパイル使用メモリ 78,892 KB
実行使用メモリ 58,964 KB
最終ジャッジ日時 2023-09-28 22:37:09
合計ジャッジ時間 11,441 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,808 KB
testcase_01 AC 127 ms
55,860 KB
testcase_02 AC 126 ms
55,448 KB
testcase_03 AC 125 ms
55,792 KB
testcase_04 AC 128 ms
55,716 KB
testcase_05 AC 126 ms
55,848 KB
testcase_06 AC 128 ms
56,052 KB
testcase_07 AC 126 ms
55,464 KB
testcase_08 WA -
testcase_09 AC 127 ms
55,840 KB
testcase_10 AC 126 ms
54,032 KB
testcase_11 AC 126 ms
55,784 KB
testcase_12 AC 125 ms
55,824 KB
testcase_13 AC 125 ms
55,824 KB
testcase_14 AC 227 ms
58,380 KB
testcase_15 AC 151 ms
55,896 KB
testcase_16 AC 229 ms
58,244 KB
testcase_17 AC 185 ms
56,588 KB
testcase_18 AC 143 ms
56,000 KB
testcase_19 AC 208 ms
56,424 KB
testcase_20 AC 214 ms
58,524 KB
testcase_21 AC 200 ms
55,980 KB
testcase_22 AC 213 ms
54,288 KB
testcase_23 AC 221 ms
58,324 KB
testcase_24 AC 125 ms
55,752 KB
testcase_25 AC 126 ms
55,840 KB
testcase_26 AC 128 ms
56,044 KB
testcase_27 AC 128 ms
55,444 KB
testcase_28 AC 127 ms
56,000 KB
testcase_29 AC 127 ms
55,388 KB
testcase_30 AC 128 ms
56,064 KB
testcase_31 AC 126 ms
56,040 KB
testcase_32 AC 233 ms
58,964 KB
testcase_33 AC 215 ms
58,012 KB
testcase_34 AC 229 ms
58,760 KB
testcase_35 AC 216 ms
58,336 KB
testcase_36 AC 236 ms
56,472 KB
testcase_37 AC 228 ms
58,552 KB
testcase_38 AC 231 ms
58,432 KB
testcase_39 AC 232 ms
58,464 KB
testcase_40 AC 229 ms
58,524 KB
testcase_41 AC 233 ms
58,744 KB
testcase_42 AC 230 ms
58,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] s = sc.next().toCharArray();
		sc.close();

		for (int i = n - 1; i >= 0; i--) {
			if (s[i] != 'w' && s[i] != 'a' && s[i] != 'o' && s[i] != 'n' && s[i] != '?') {
				System.out.println("No");
				return;
			}
			if (s[i] == 'a' || s[i] == 'o') {
				if (i == 0 || s[i - 1] != 'w' && s[i - 1] != '?') {
					System.out.println("No");
					return;
				}
				s[i - 1] = 'w';
			}
			if (s[i] == 'w' || s[i] == 'n') {
				if (i != 0 && s[i - 1] == 'w') {
					System.out.println("No");
					return;
				}
			}
		}
		System.out.println("Yes");
	}
}
0