結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
dgd1724
|
| 提出日時 | 2016-11-11 06:52:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,878 bytes |
| コンパイル時間 | 2,974 ms |
| コンパイル使用メモリ | 165,848 KB |
| 実行使用メモリ | 7,704 KB |
| 最終ジャッジ日時 | 2024-11-06 23:17:27 |
| 合計ジャッジ時間 | 2,460 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 6 |
ソースコード
#include <bits/stdc++.h>
//const static double de_PI = 3.14159265358979323846;
//const static int de_MOD = 1000000007;
//const static int de_MAX = 999999999;
//const static int de_MIN = -999999999;
inline std::vector<std::string> Split_String(const std::string &str, const char key) {
std::vector<std::string> result;
std::stringstream SS(str);
std::string temp;
while (std::getline(SS, temp, key)) {
result.push_back(temp);
}
return(result);
}
int main(void) {
//std::ifstream inf("123.txt"); std::cin.rdbuf(inf.rdbuf());
std::string str;
while (1) {
std::getline(std::cin, str);
if (str == "") { break; }
std::vector<std::string> split = Split_String(str, ' ');
if (split.size() < 2) {
std::cout << "WRONG!" << std::endl;
continue;
}
std::string ed;
if (split[0] == "digi") { ed = "nyo"; }
else if (split[0] == "petit") { ed = "nyu"; }
else if (split[0] == "rabi") { ed = "rabi"; }
else if (split[0] == "gema") { ed = "gema"; }
else if (split[0] == "piyo") { ed = "pyo"; }
else {
std::cout << "WRONG!" << std::endl;
continue;
}
str.erase(str.begin(), str.begin() + split[0].length() + 1);
std::transform(str.begin(), str.end(), str.begin(), tolower);
bool flg = false;
if (ed == "rabi") {
for (unsigned int i = 5; i < str.length(); i++) {
if (std::isalpha(str[i]) || std::isdigit(str[i])) {
flg = true;
break;
}
}
}
else {
unsigned int found = str.rfind(ed);
if (found != std::string::npos) {
if (str.length() - found - ed.length() <= 3) {
flg = true;
for (unsigned int i = found + ed.length(); i < str.length(); i++) {
if (std::isalpha(str[i]) || std::isdigit(str[i])) {
flg = false;
break;
}
}
}
}
}
if (flg) { std::cout << "CORRECT (maybe)" << std::endl; }
else { std::cout << "WRONG!" << std::endl; }
}
}
dgd1724