Submission #3885434


Source Code Expand

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

#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define FOR_IN(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define IN(x, a, b) ((x) >= (a) && (x) <= (b))

using namespace std;

/*
t 100
s 100
 */

int t;
char s[100][101];

int main(){
  cin >> t;

  REP(i,t)
    cin >> s[i];

  REP(i,t){
    vector<int> b;
    int l=strlen(s[i]);
    REP(j,l-1){
      if(!strncmp(s[i]+j,"tokyo",5) || !strncmp(s[i]+j,"kyoto",5))
        b.push_back(j);
    }

    int last=-10;
    int ans=0;
    for(int k : b){
      if(k>=last+5){
        last=k;
        ans++;
      }
    }

    cout << ans << endl;
  }

  return 0;
}

Submission Info

Submission Time
Task A - 東京都
User linuxojisan009
Language C++14 (GCC 5.4.1)
Score 100
Code Size 704 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