結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2016-06-18 01:19:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 995 bytes |
| コンパイル時間 | 977 ms |
| コンパイル使用メモリ | 81,264 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-06 22:54:37 |
| 合計ジャッジ時間 | 1,602 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 WA * 5 |
ソースコード
#include <iostream>
#include <string>
#include <map>
#include <cctype>
using namespace std;
map<string, string> suffix;
bool correct(const string& words, const string& name)
{
if (name=="rabi") {
for(auto& c: words) if (isalnum(c)) return true;
return false;
}
int n=words.size();
auto k=words.find_last_of(suffix[name]);
if (k==string::npos) return false;
if (k<n-3) return false;
for(int i=k+1; i<n; ++i) if (isalnum(words[i])) return false;
return true;
}
int main()
{
string names[]={"digi", "petit", "gema", "piyo"};
string suffs[]={"nyo", "nyu", "gema", "pyo"};
for(int i=0; i<4; ++i) suffix[names[i]]=suffs[i];
string s;
while (getline(cin, s)) {
string name=s.substr(0, s.find(' '));
string words=s.substr(s.find(' ')+1);
for(auto& c: words) c=tolower(c);
if (correct(words, name))
cout<<"CORRECT (maybe)"<<endl;
else
cout<<"WRONG!"<<endl;
}
}
hogeover30