Submission #533051


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;

int main()
{
  int n;
  cin >> n;

  string tokyo = "tokyo";
  string kyoto = "kyoto";
  reverse(tokyo.begin(), tokyo.end());
  reverse(kyoto.begin(), kyoto.end());

  while(n--) {
    string s; cin >> s;
    reverse(s.begin(), s.end());

    int cnt = 0;
    for (int i = 0; i < s.size();) {
      string t = s.substr(i, 5);
      if (t == tokyo || t == kyoto) {
        cnt++;
        i += 4;
      } else {
        i++;
      }
    }
    cout << cnt << endl;
  }
	return 0;
}

Submission Info

Submission Time
Task A - 東京都
User Akeru
Language C++ (GCC 4.9.2)
Score 100
Code Size 611 Byte
Status AC
Exec Time 28 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 27 ms 916 KB
20_noised_tokyoto.txt AC 28 ms 916 KB
99_teuchi.txt AC 27 ms 732 KB