結果
問題 |
No.380 悪の台本
|
ユーザー |
![]() |
提出日時 | 2025-04-20 21:52:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 53 ms / 1,000 ms |
コード長 | 1,712 bytes |
コンパイル時間 | 1,802 ms |
コンパイル使用メモリ | 167,252 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-20 21:52:14 |
合計ジャッジ時間 | 2,777 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 |
ソースコード
#include <bits/stdc++.h> #define int long long //#define USE_FREOPEN //#define MUL_TEST #define FILENAME "dialogue" using namespace std; void solve() { string s; while (getline(cin,s)) { int n = s.length(); s = ' ' + s; string name = ""; for (int i = 1; s[i] != ' '; i++) name += s[i]; if (name == "rabi") { bool flag = 0; for (int i = 6; i <= n; i++) if (isdigit(s[i]) || isalpha(s[i])) { flag = 1; break; } cout << (flag ? "CORRECT (maybe)\n" : "WRONG!\n"); } else { if (n - name.length() - 1 < 3) { cout << "WRONG!\n"; continue; } if (n - name.length() - 1 < 4 && name == "gema") { cout << "WRONG!\n"; continue; } int pos = n,cnt = 0; while (!isdigit(s[pos]) && !isalpha(s[pos]) && cnt <= 3) { cnt++; pos--; } if (cnt > 3) { cout << "WRONG!\n"; continue; } string ed = ""; for (int i = pos; i >= pos - 2; i--) ed = (char)tolower(s[i]) + ed; if (name == "digi") { cout << (ed == "nyo" ? "CORRECT (maybe)\n" : "WRONG!\n"); } else if (name == "petit") { cout << (ed == "nyu" ? "CORRECT (maybe)\n" : "WRONG!\n"); } else if (name == "piyo") { cout << (ed == "pyo" ? "CORRECT (maybe)\n" : "WRONG!\n"); } else if (name == "gema") { ed = (char)tolower(s[pos - 3]) + ed; cout << (ed == "gema" ? "CORRECT (maybe)\n" : "WRONG!\n"); } else { cout << "WRONG!\n"; } } } } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #ifdef USE_FREOPEN freopen(FILENAME ".in","r",stdin); freopen(FILENAME ".out","w",stdout); #endif int _ = 1; #ifdef MUL_TEST cin >> _; #endif while (_--) solve(); _^=_; return 0^_^0; }