Submission #5558958


Source Code Expand

#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
int main()
{
    int n;
    cin >> n;
    while (n--)
    {
        int count = 0;
        string s;
        cin >> s;
        int len = s.size();
        rep(i, len - 4)
        {
            string t = s.substr(i, 5);
            if (t == "kyoto" || t == "tokyo")
            {
                i += 4;
                count++;
            }
        }

        cout << count << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task A - 東京都
User Yui_1991
Language C++14 (GCC 5.4.1)
Score 100
Code Size 797 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