Submission #532988


Source Code Expand

#include <bits/stdc++.h>
#define all(x) begin(x),end(x)
#define rall(x) (x).rbegin(),(x).rend()
#define REP(i,b,n) for(int i=(int)(b);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define repsz(i,v) rep(i,(v).size())
#define aur auto&
#define bit(n) (1LL<<(n))
#define eb emplace_back
#define mt make_tuple
#define fst first
#define snd second
using namespace std;
typedef long long ll;
//#define int long long
template<class C>int size(const C &c){ return c.size(); }
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}

bool solve(){
    string s; cin >> s;
    const int n = size(s);
    int res = 0;
    rep(i, n){
        if(s.substr(i, 5) == "tokyo"){
            i += 5; ++res;
        } else if(s.substr(i, 5) == "kyoto"){
            i += 5; ++res;
        }
    }
    cout << res << endl;
    return true;
}
signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
    int t; cin >> t;
    rep(_, t) solve();
    return 0;
}
// vim:set foldmethod=marker commentstring=//%s:

Submission Info

Submission Time
Task A - 東京都
User MiSawa
Language C++11 (GCC 4.9.2)
Score 0
Code Size 1269 Byte
Status WA
Exec Time 29 ms
Memory 920 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 29 ms 804 KB
20_noised_tokyoto.txt WA 27 ms 792 KB
99_teuchi.txt WA 29 ms 920 KB