Submission #3365121


Source Code Expand

#include <iostream>
#include <string>
using namespace std;

int main() {
    int T;
    cin >> T;
    string S, tokyo = "tokyo", kyoto = "kyoto";
    while (T--) {
        cin >> S;
        int ans = 0;
        for (int i = 0; i < S.size(); ++i) {
            if (S[i] == 't') {
                bool can = true;
                for (int j = 0; j < 4; ++j) {
                    if (S[i + j] != tokyo[j]) {
                        can = false;
                        break;
                    }
                }
                if (can) {
                    ++ans;
                    i += 5;
                }
            }
            if (S[i] == 'k') {
                bool can = true;
                for (int j = 0; j < 5; ++j) {
                    if (S[i + j] != kyoto[j]) {
                        can = false;
                        break;
                    }
                }
                if (can) {
                    ++ans;
                    i += 5;
                }
            }
        }
        cout << ans << endl;
    }
    
    return 0;
}

Submission Info

Submission Time
Task A - 東京都
User gom74
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1116 Byte
Status WA
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 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 WA 2 ms 256 KB
20_noised_tokyoto.txt WA 2 ms 256 KB
99_teuchi.txt WA 1 ms 256 KB