Submission #3879075


Source Code Expand

#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;

	string s[t];
	rep(i, t) cin >> s[i];

	rep(i, t){
		string a = s[i];
		int n = a.length();
		bool used[n];
		int ans = 0;
		rep(k, n) used[k] = false;
		for(int j = 0; j+4 < a.length(); j++){
			if(!used[j] && a.substr(j, 5) == "tokyo"){
				ans++;
				rep(l, 5) used[j+l] = true;
			}
			if(!used[j] && a.substr(j, 5) == "kyoto"){
				ans++;
				rep(l, 5) used[j+l] = true;
			}
		}

		cout << ans << endl;
	}
}

Submission Info

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