Submission #533080


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		string s;
		cin >> s;
		s += "zzzzzz";
		int cnt = 0;
		for (int i = 0; i < s.size() - 4;i++)
		{
			string tmp = s.substr(i, 5);
			if (tmp == "kyoto" || tmp == "tokyo")
			{
				i += 4;
				cnt++;
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

Submission Info

Submission Time
Task A - 東京都
User amano
Language C++11 (GCC 4.9.2)
Score 100
Code Size 967 Byte
Status AC
Exec Time 45 ms
Memory 804 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 27 ms 804 KB
20_noised_tokyoto.txt AC 45 ms 792 KB
99_teuchi.txt AC 26 ms 796 KB