Submission #532979


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
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 EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  int T; cin >> T;
  while(T--){
	string s; cin >> s;
	int ans = 0;
	for(int i=0;i<SZ(s);++i){
	  if(s.substr(i,5) == "tokyo"){
		++ans;
		i += 5 - 1;
	  }
	  if(s.substr(i,5) == "kyoto"){
		++ans;
		i += 5 - 1;
	  }
	}
	cout << ans << endl;
  }
  
  return 0;
}

Submission Info

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