Submission #5581084


Source Code Expand

#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<cstdlib>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define p(s) cout << (s) << endl
#define p2(s,t) cout << (s) << " " << (t) << endl 
#define ALL(v) (v).begin(), (v).end()
typedef long long ll;
using namespace std;

static const ll mod  = 1e9 + 7;
static const ll inf  = 1e18;

static const int White = 0;
static const int Gray = 1;
static const int Black = 2;

void pvector(vector<int> A){
    cout << "[vector]";
    for(int i = 0; i < A.size(); i++){
        cout << A[i] << " ";
    }
    cout << endl;
}

int main(){
    int T;
    cin >> T;
    string S;
    int cnt = 0;
    string divide[2] ={"kyoto", "tokyo"} ;
    REP(i,T){
        cin >> S;
        for(int j = 0; j < S.size();){
            bool can = 0;
            for(int k = 0; k < 2; k++){
                if(S.substr(j,5) == divide[k]){
                    j += 5;
                    can = 1;
                    cnt++;
                    break;
                }
            }
            if(!can) j++;
        }
        p(cnt);
        cnt = 0;
    }
}

Submission Info

Submission Time
Task A - 東京都
User raoZ
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1247 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 3 ms 256 KB
20_noised_tokyoto.txt AC 3 ms 256 KB
99_teuchi.txt AC 2 ms 256 KB