結果

問題 No.380 悪の台本
ユーザー CleyLCleyL
提出日時 2022-08-19 21:42:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,660 bytes
コンパイル時間 779 ms
コンパイル使用メモリ 76,160 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-17 00:22:41
合計ジャッジ時間 1,815 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 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 AC 140 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
int main(){
    string s;
    while(getline(cin,s)){
        string u = "";
        if(s.size() >= 4 && s.substr(0,4) == "digi")u = "digi";
        else if(s.size() >= 5 && s.substr(0,5) == "petit")u = "petit";
        else if(s.size() >= 4 && s.substr(0,4) == "rabi")u = "rabi";
        else if(s.size() >= 4 && s.substr(0,4) == "gema")u = "gema";
        else if(s.size() >= 4 && s.substr(0,4) == "piyo")u = "piyo";

        for(int i = 1; s.size() > i; i++){
            if('a' <= s[i] && s[i] <= 'z')s[i] = s[i]-'a'+'A';
        }
        //cout << s << endl;
        
        bool ok = false;
        if(u == "digi"){
            for(int i = 0; 3 >= i; i++){
                if((int)s.size()-i-3 >= 3 && s.substr(s.size()-i-3,3) == "NYO")ok = true;
            }
        }else if(u == "petit"){
            for(int i = 0; 3 >= i; i++){
                if((int)s.size()-i-3 >= 3 && s.substr(s.size()-i-3,3) == "NYU")ok = true;
                
            }
        }else if(u == "rabi"){
            for(int i = 4; s.size() > i; i++){
                if('A' <= s[i] && s[i] <= 'Z')ok = true;
            }
        }else if(u == "gema"){
            for(int i = 0; 3 >= i; i++){
                if((int)s.size()-i-4 >= 4 && s.substr((int)s.size()-i-4,4) == "GEMA")ok = true;
            }
        }else if(u == "piyo"){
            for(int i = 0; 3 >= i; i++){
                if((int)s.size()-i-3 >= 3 && s.substr(s.size()-i-3,3) == "PYO")ok = true;
            }
        }
        if(ok){
            cout << "CORRECT (maybe)" << endl;
        }else{
            cout << "WRONG!" << endl;
        }
    }
    
}
0