結果

問題 No.380 悪の台本
ユーザー furafura
提出日時 2020-05-31 02:36:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,163 bytes
コンパイル時間 2,197 ms
コンパイル使用メモリ 197,816 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 22:02:30
合計ジャッジ時間 3,715 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 6 ms
5,376 KB
testcase_05 AC 16 ms
5,376 KB
testcase_06 AC 16 ms
5,376 KB
testcase_07 AC 142 ms
5,376 KB
testcase_08 AC 5 ms
5,376 KB
testcase_09 AC 8 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0