結果

問題 No.380 悪の台本
ユーザー femtofemto
提出日時 2016-08-22 03:50:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,144 bytes
コンパイル時間 692 ms
コンパイル使用メモリ 79,768 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 14:44:06
合計ジャッジ時間 1,210 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

bool check(string s, string gobi) {
	if(s.size() < gobi.size()) return false;
	for(int i = 0; i <= 3; i++) {
		bool flag = true;
		for(int j = 0; j < gobi.size(); j++) {
			int p = s.size() - gobi.size() - i + j;
			if(s[p] != gobi[j]) {
				flag = false;
				break;
			}
		}
		if(flag) return true;
	}
	return false;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	string name, s;
	while(cin >> name) {
		getline(cin, s);
		for(int i = 0; i < s.size(); i++) {
			if('A' <= s[i] && s[i] <= 'Z')
				s[i] = tolower(s[i]);
		}
		bool ok = false;
		if(name == "digi") {
			ok = check(s, "nyo");
		}
		else if(name == "petit") {
			ok = check(s, "nyu");
		}
		else if(name == "rabi") {
			for(int i = 0; i < s.size(); i++) {
				if(isdigit(s[i]) || isalpha(s[i])) ok = true;
			}
		}
		else if(name == "gema") {
			ok = check(s, "gema");
		}
		else {
			ok = check(s, "pyo");
		}
		if(ok) {
			cout << "CORRECT (maybe)" << endl;
		}
		else {
			cout << "WRONG!" << endl;
		}
	}
}
0