Submission #5413851


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

string S;

bool ok(int n){ //S.at(n)から始まる tokyoかkyotoがある.
    bool flag=false;
    if(S.at(n)=='t' && S.at(n+1)=='o' && S.at(n+2)=='k' &&
        S.at(n+3)=='y'  && S.at(n+4)=='o'  ) flag =true;
    if(S.at(n)=='k' && S.at(n+1)=='y' && S.at(n+2)=='o' &&
        S.at(n+3)=='t'  && S.at(n+4)=='o'  ) flag =true;
    return flag;
}

int main(){
    int T; cin >> T;
    for(int i=0; i<T; i++){
        cin >> S;
        int cnt =0;
        int j=0;
        while(j< S.size()-4){
            if(ok(j)){
                cnt++;
                j +=5;
            }
            else j++;
        }
        cout << cnt << endl;
    }
}

Submission Info

Submission Time
Task A - 東京都
User flowsignal
Language C++14 (GCC 5.4.1)
Score 0
Code Size 722 Byte
Status RE
Exec Time 99 ms
Memory 384 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 2
RE × 1
Set Name Test Cases
All 10_random_to_kyo.txt, 20_noised_tokyoto.txt, 99_teuchi.txt
Case Name Status Exec Time Memory
10_random_to_kyo.txt AC 2 ms 256 KB
20_noised_tokyoto.txt AC 2 ms 256 KB
99_teuchi.txt RE 99 ms 384 KB