Submission #3020071


Source Code Expand

#include <iostream>
#include <string>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

int T;

int main()
{
  std::cin >> T;
  rep( t, T )
  {
    std::string S;
    std::cin >> S;

    int ans = 0;

    rep( i, S.size() )
    {
      std::string tmp = S.substr( i, 5 );

      if( tmp == "tokyo" || tmp == "kyoto" )
        ++ans, i += 4;
    }

    printf( "%d\n", ans );
  }
  
  return 0;
}

Submission Info

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