結果

問題 No.380 悪の台本
ユーザー furafura
提出日時 2020-05-31 02:38:08
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 130 ms / 1,000 ms
コード長 1,220 bytes
コンパイル時間 4,218 ms
コンパイル使用メモリ 200,448 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-09 07:22:12
合計ジャッジ時間 3,112 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 6 ms
4,380 KB
testcase_05 AC 16 ms
4,384 KB
testcase_06 AC 15 ms
4,384 KB
testcase_07 AC 130 ms
4,384 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 8 ms
4,388 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