結果
問題 | No.2373 wa, wo, n |
ユーザー |
|
提出日時 | 2023-08-01 23:09:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 662 bytes |
コンパイル時間 | 644 ms |
コンパイル使用メモリ | 72,548 KB |
最終ジャッジ日時 | 2025-02-15 21:24:33 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 39 |
ソースコード
#include <iostream>#include <vector>using namespace std;#define YES cout << "Yes" << endl#define NO cout << "No" << endlint main(void){int n;string s;cin >> n >> s;int mcnt = 0;string sub1, sub2;for (int i = 0; i < (int)s.size(); i++) {sub1 = s.substr(i, 1);sub2 = s.substr(i, 2);if (sub2 == "w?") {mcnt += 2;i++;}else if (sub2 == "?a" || sub2 == "?o") {mcnt += 2;i++;}else if (sub2 == "wa" || sub2 == "wo") {mcnt += 2;i++;}else if (sub1 == "?" || sub1 == "n") {mcnt++;}}mcnt == (int)s.size() ? YES : NO;}