Submission #3923236


Source Code Expand

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int main(){
  int t;
  cin >> t;
  vector<string> v(t, "@");
  for (int i = 0; i < t; i++) {
    cin >> v[i];
  }

  for (int i = 0; i < t; i++) {
    int res = 0;
    int size = int(v[i].size());
    for (int j = 0; j < size-4; j++) {
      if(v[i][j] == 't'){
        string tmp = v[i].substr(j, 5);
        if(tmp == "tokyo"){
          res++;
          j += 4;
        }
      }

      if(v[i][j] == 'k'){
        string tmp = v[i].substr(j, 5);
        if(tmp == "kyoto"){
          res++;
          j += 4;
        }
      }
    }
    cout << res << endl;
  }

}

Submission Info

Submission Time
Task A - 東京都
User inazuma110
Language C++14 (GCC 5.4.1)
Score 100
Code Size 852 Byte
Status AC
Exec Time 2 ms
Memory 256 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 2 ms 256 KB
20_noised_tokyoto.txt AC 2 ms 256 KB
99_teuchi.txt AC 2 ms 256 KB