結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
femto
|
| 提出日時 | 2016-08-22 04:14:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,347 bytes |
| コンパイル時間 | 998 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-06 23:09:39 |
| 合計ジャッジ時間 | 1,903 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 1 |
ソースコード
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <sstream>
using namespace std;
bool isSymbol(char c) {
return !isdigit(c) && !isalpha(c);
}
bool check(string s, string gobi) {
if(s.size() < gobi.size()) return false;
for(int i = 0; i <= 3; i++) {
if(s.size() < gobi.size() + i) continue;
if(s.substr(s.size() - gobi.size() - i, gobi.size()) != gobi)
continue;
bool flag = true;
for(int j = 0; j < i; j++) {
int p = s.size() - 1 - j;
if(!isSymbol(s[p])) {
flag = false;
break;
}
}
if(flag) return true;
}
return false;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
string name, s;
while(getline(cin, s)) {
stringstream ss(s);
ss >> name;
getline(ss, s);
for(int i = 0; i < s.size(); i++) {
if('A' <= s[i] && s[i] <= 'Z')
s[i] = tolower(s[i]);
}
bool ok = false;
if(name == "digi") {
ok = check(s, "nyo");
}
if(name == "petit") {
ok = check(s, "nyu");
}
if(name == "rabi") {
for(int i = 0; i < s.size(); i++) {
if(isSymbol(s[i])) ok = true;
}
}
if(name == "gema") {
ok = check(s, "gema");
}
if(name == "piyo") {
ok = check(s, "pyo");
}
if(ok) {
cout << "CORRECT (maybe)" << endl;
}
else {
cout << "WRONG!" << endl;
}
}
}
femto