Submission #2201169


Source Code Expand

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

string s;
string to = "tokyo", ky = "kyoto";


int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
    cin >> s;
    int ans = 0;
    bool flag = true;
    for(int i = 0; i < s.length()-4; i++){
        if(s[i] == 't'){
            flag = true;
            for(int j = 0; j <to.length(); j++){
                if(s[i+j] != to[j]) flag = false;
            }
            if(flag){
                ++ans;
                for(int j = 0; j <to.length(); j++) s[i+j] = '0';
            }
        }
        else if(s[i] == 'k'){
            flag = true;
            for(int j = 0; j <to.length(); j++){
                if(s[i+j] != ky[j]) flag = false;
            }
            if(flag){
                ++ans;
                for(int j = 0; j <to.length(); j++) s[i+j] = '0';
            }
        }
    }
    cout << ans << endl;
    }
}

Submission Info

Submission Time
Task A - 東京都
User m0bec
Language C++14 (GCC 5.4.1)
Score 0
Code Size 936 Byte
Status RE
Exec Time 99 ms
Memory 256 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 256 KB