Submission #532961


Source Code Expand

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

const string tokyo = "tokyo";
const string kyoto = "kyoto";

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int T;
    cin >> T;
    while (T--) {
        string s;
        cin >> s;
        int n = s.size();
        int cur = 0;
        int ans = 0;
        while (cur < n) {
            if (s.substr(cur, 5) == tokyo) {
                ans++;
                cur += 5;
            } else if (s.substr(cur, 5) == kyoto) {
                ans++;
                cur += 5;
            } else {
                cur++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task A - 東京都
User mayoko
Language C++11 (GCC 4.9.2)
Score 100
Code Size 1241 Byte
Status AC
Exec Time 31 ms
Memory 920 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 31 ms 796 KB
20_noised_tokyoto.txt AC 29 ms 792 KB
99_teuchi.txt AC 28 ms 920 KB