結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-31 02:36:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,163 bytes |
| コンパイル時間 | 2,443 ms |
| コンパイル使用メモリ | 195,636 KB |
| 最終ジャッジ日時 | 2025-01-10 19:50:56 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 RE * 1 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
while(1){
string s; getline(cin,s);
if(cin.eof()) break;
int idx=s.find(' ');
if(idx==string::npos){
puts("WRONG!");
continue;
}
string name=s.substr(0,idx);
s=s.substr(idx+1);
for(char& c:s) c=tolower(c);
if(name=="digi"){
rep(i,3) if(!isalnum(s.back())) s.pop_back();
int m=s.length();
puts(m>=3&&s.substr(m-3)=="nyo"?"CORRECT (maybe)":"WRONG!");
}
else if(name=="petit"){
rep(i,3) if(!isalnum(s.back())) s.pop_back();
int m=s.length();
puts(m>=3&&s.substr(m-3)=="nyu"?"CORRECT (maybe)":"WRONG!");
}
else if(name=="rabi"){
while(!s.empty() && !isalnum(s.back())) s.pop_back();
puts(!s.empty()?"CORRECT (maybe)":"WRONG!");
}
else if(name=="gema"){
rep(i,3) if(!isalnum(s.back())) s.pop_back();
int m=s.length();
puts(m>=4&&s.substr(m-4)=="gema"?"CORRECT (maybe)":"WRONG!");
}
else if(name=="piyo"){
rep(i,3) if(!isalnum(s.back())) s.pop_back();
int m=s.length();
puts(m>=3&&s.substr(m-3)=="pyo"?"CORRECT (maybe)":"WRONG!");
}
else{
puts("WRONG!");
}
}
return 0;
}