結果

問題 No.380 悪の台本
ユーザー ida1ten0ida1ten0
提出日時 2016-06-22 23:13:49
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,345 bytes
コンパイル時間 1,282 ms
コンパイル使用メモリ 161,248 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 14:35:52
合計ジャッジ時間 2,115 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void solve(string s, string word) {

    int idx;

    if(s.rfind(word) != string::npos) {
        idx = s.rfind(word) + word.size();
        if(idx + 3 >= s.size()) {
            while(s[idx] != '\0' && !isalnum(s[idx])) ++idx;
            if(idx == s.size()){
                cout << "CORRECT (maybe)" << endl;
            } else {
                cout << "WRONG!" << endl;
            }
        } else {
            cout << "WRONG!" << endl;
        }
    } else {
        cout << "WRONG!" << endl;
    }

}

int main() {

    int idx;
    string name, s;

    while(cin >> name) {

        getline(cin, s);

        for(int i = 0; i < s.size(); ++i) {
            if(s[i] >= 'A' && s[i] <= 'Z') {
                s[i] += 'a' - 'A';
            }
        }

        if(name == "digi") {
            solve(s, "nyo");
        } else if(name == "petit") {
            solve(s, "nyu");
        } else if(name == "rabi") {
            idx = 0;
            while(!isalnum(s[idx])) ++idx;
            if(idx == s.size()) {
                cout << "WRONG!" << endl;
            } else {
                cout << "CORRECT (maybe)" << endl;
            }
        } else if(name == "gema") {
            solve(s, "gema");
        } else if(name == "piyo") {
            solve(s, "pyo");
        }

    }

}
0