Submission #5536828


Source Code Expand

#include "bits/stdc++.h"

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1 << 30;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};

int t;

int main(void){
	cin>>t;
	for(int i=0;i<t;i++) {
		string S; cin>>S;
		int ans = 0;
		
		int j = 0;
		while(j + 5 - 1 < S.size()) {
			if(S.substr(j, 5) == "kyoto" || S.substr(j, 5) == "tokyo") {
				ans++;
				j += 5;
			}
			else j++;
		}

		//cout<<" S :"<< S <<endl<<endl;

		cout<< ans <<endl;
	}

	return 0;
}

Submission Info

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