結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 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 133 ms
5,376 KB
testcase_08 AC 4 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(!s.empty() && !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(!s.empty() && !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(!s.empty() && !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(!s.empty() && !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