Submission #3674823


Source Code Expand

#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

bool check(int s, string st) {
	string cor1 = "tokyo";
	string cor2 = "kyoto";

	bool ok1 = true;
	bool ok2 = true;
	for (int i = 0; i < 5; ++i) {
		if (st[s + i] != cor1[i]) { ok1 = false; }
		if (st[s + i] != cor2[i]) { ok2 = false; }
	}

	return (ok1 || ok2);
}

int main() {
	int t;
	cin >> t;
	vector<string> s(t);
	for (int i = 0; i < t; ++i) { cin >> s[i]; }

	vector<int> res(t, 0);
	for (int i = 0; i < t; ++i) {
		if (s[i].size() < 5) { continue; }

		int j = 0;
		while (j < s[i].size()) {
			if ((s[i][j] == 't') || (s[i][j] == 'k')) {
				if (check(j, s[i])) {
					++res[i];
					j += 4;
				}
			}
			++j;
		}
	}

	for (int i = 0; i < t; ++i) {
		cout << res[i] << endl;
	}

	return 0;
}

Submission Info

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