結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
ida1ten0
|
| 提出日時 | 2016-06-22 23:13:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,345 bytes |
| コンパイル時間 | 1,368 ms |
| コンパイル使用メモリ | 161,120 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-06 23:00:34 |
| 合計ジャッジ時間 | 2,125 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 3 RE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void solve(string s, string word) {
int idx;
if(s.rfind(word) != string::npos) {
idx = s.rfind(word) + word.size();
if(idx + 3 >= s.size()) {
while(s[idx] != '\0' && !isalnum(s[idx])) ++idx;
if(idx == s.size()){
cout << "CORRECT (maybe)" << endl;
} else {
cout << "WRONG!" << endl;
}
} else {
cout << "WRONG!" << endl;
}
} else {
cout << "WRONG!" << endl;
}
}
int main() {
int idx;
string name, s;
while(cin >> name) {
getline(cin, s);
for(int i = 0; i < s.size(); ++i) {
if(s[i] >= 'A' && s[i] <= 'Z') {
s[i] += 'a' - 'A';
}
}
if(name == "digi") {
solve(s, "nyo");
} else if(name == "petit") {
solve(s, "nyu");
} else if(name == "rabi") {
idx = 0;
while(!isalnum(s[idx])) ++idx;
if(idx == s.size()) {
cout << "WRONG!" << endl;
} else {
cout << "CORRECT (maybe)" << endl;
}
} else if(name == "gema") {
solve(s, "gema");
} else if(name == "piyo") {
solve(s, "pyo");
}
}
}
ida1ten0