Submission #5532475


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;
		if(S.size() < 5) continue;
		for(int j=0;j + 5 - 1<S.size();j++) {
			if(S.substr(j, 5) == "kyoto" || S.substr(j, 5) == "tokyo") {
				//for(int j=i;j<5;j++) S[j] = 'x';
				int k = 0;
				while(k < 5) {
					S[j++] = 'x';
					k++;
				}
				ans++;
			}
		}

		//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 0
Code Size 871 Byte
Status WA
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 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 WA 2 ms 256 KB
20_noised_tokyoto.txt WA 2 ms 256 KB
99_teuchi.txt WA 2 ms 256 KB