Submission #532936


Source Code Expand

// * template

#include <bits/stdc++.h>
#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif

using namespace std;

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

template<class T, class U> inline void fill_array(T &e, const U &v) { e = v; }
template<class T, class U, size_t s> inline void fill_array(T (&a)[s], const U &v) {for(auto&e:a)fill_array(e,v);}
template<class T, class U, size_t s> inline void fill_array(array<T, s> &a, const U &v) {for(auto&e:a)fill_array(e,v);}
template<class T, class U> inline void fill_array(vector<T> &a, const U &v) {for(auto&e:a)fill_array(e,v);}

// * solve

int main(int argc, const char *const argv[]) {
#ifdef LOCAL
	init_debug(argc, argv);
#endif

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;

	for(int i = 0; i < t; ++i) {
		string s;
		cin >> s;

		int cnt = 0;
		int j = 0;
		while(j + 5 <= s.size()) {
			const auto tmp = s.substr(j, 5);
			if(tmp == "kyoto" || tmp == "tokyo") {
				j += 5;
				++cnt;
			}
			else {
				++j;
			}
		}

		cout << cnt << endl;
	}

	return EXIT_SUCCESS;
}

Submission Info

Submission Time
Task A - 東京都
User nisshy
Language C++11 (GCC 4.9.2)
Score 100
Code Size 1228 Byte
Status AC
Exec Time 28 ms
Memory 928 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 28 ms 928 KB
20_noised_tokyoto.txt AC 27 ms 796 KB
99_teuchi.txt AC 27 ms 924 KB