Submission #533077


Source Code Expand

#include <algorithm>
#include <iostream>
#include <set>
#include <iterator>
#include <cmath>
#include <tuple>
#include <stack>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <limits>
#include <cassert>

using namespace std;

template<class T = int>
inline bool within(T min_x, T x, T max_x){ return min_x<=x&&x<max_x; }
typedef long long ll;

int count(string &str,string &key){
	int ind = 0, ret = 0;
	bool flag;
	do{
		auto it = str.find(key,ind);
		flag = it!=string::npos;
		if(flag){
			ind = it+1;
			ret++;
		}
	}while(flag);
	return ret;
}
int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string tkt = "tokyoto";
    string tk = "tokyo";
    string kt = "kyoto";
    for(int i = 0; i < n; ++i){
    	string str;
    	cin >> str;
    	int tktc = count(str,tkt);
    	int tkc = count(str,tk);
    	int ktc = count(str,kt);
    	cout << tkc+ktc-tktc << endl;
    }
  return 0;
}

Submission Info

Submission Time
Task A - 東京都
User iraytno
Language C++11 (GCC 4.9.2)
Score 0
Code Size 1010 Byte
Status WA
Exec Time 36 ms
Memory 1176 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 36 ms 1172 KB
20_noised_tokyoto.txt WA 30 ms 1072 KB
99_teuchi.txt WA 31 ms 1176 KB