Submission #3836228


Source Code Expand

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
using namespace std;

int T;
string S[100];

int main() {
    cin >> T;
    rep(i, T)   cin >> S[i];
    rep(i, T) {
        string s(S[i]);
        auto kp = s.find("kyoto");
        auto tp = s.find("tokyo");
        int res = 0;

        while( kp != string::npos or tp != string::npos ) {
            s = s.substr( min(kp,tp)+5 );
            res++;
            kp = s.find("kyoto");
            tp = s.find("tokyo");
        }
        cout << res << endl;
    }
}

Submission Info

Submission Time
Task A - 東京都
User ren_amaike
Language C++14 (GCC 5.4.1)
Score 100
Code Size 619 Byte
Status AC
Exec Time 2 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 2 ms 256 KB
99_teuchi.txt AC 2 ms 256 KB