Submission #5498140


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
bool tokyo(int x, string s) {
    return s.at(x)=='t' && s.at(x+1)=='o' && s.at(x+2)=='k' && s.at(x+3)=='y' && s.at(x+4)=='o';
}
bool kyoto(int x, string s) {
    return s.at(x)=='k' && s.at(x+1)=='y' && s.at(x+2)=='o' && s.at(x+3)=='t' && s.at(x+4)=='o';
}

int main() {
    int T;
    cin >> T;
    vector<string> S(T);
    for(string s : S) {
        cin >> s;
        int cnt = 0;
        int x = 0;
        while (s.size() >= 5 && x < s.size()-4) {
            if(tokyo(x, s) || kyoto(x, s)) {
                cnt++;
                x+=5;
            }
            else x++;
        }
        cout << cnt << endl;
    }
}

Submission Info

Submission Time
Task A - 東京都
User gyouzasushi
Language C++14 (GCC 5.4.1)
Score 100
Code Size 700 Byte
Status AC
Exec Time 3 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 3
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 3 ms 256 KB
99_teuchi.txt AC 2 ms 256 KB