Submission #533064


Source Code Expand

//include
//------------------------------------------
#include <bits/stdc++.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline long long toLL(string s) {long long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
#define CLR(a) memset((a), 0 ,sizeof(a))


const string tokyo="tokyo",kyoto="kyoto";

int main(){
	int T;cin>>T;
	REP(tt,T){
		string str;
		cin>>str;
		int p1=0,p2=0;
		int res=0;
		REP(i,SZ(str)){
			if(str[i]==tokyo[p1])p1++;
			else p1=0;
			if(str[i]==kyoto[p2])p2++;
			else p2=0;
			if(p1==5||p2==5){
				res++;
				p1=p2=0;
			}
		}
		cout<<res<<endl;
	}
	
	return 0;
}

Submission Info

Submission Time
Task A - 東京都
User blue0620
Language C++11 (GCC 4.9.2)
Score 0
Code Size 1668 Byte
Status WA
Exec Time 28 ms
Memory 928 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 28 ms 796 KB
20_noised_tokyoto.txt WA 27 ms 928 KB
99_teuchi.txt WA 26 ms 808 KB