Submission #532980
Source Code Expand
#include <bits/stdc++.h> #define PB push_back #define MP make_pair #define REP(i,n) for (int i=0;i<(n);i++) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define ALL(a) (a).begin(),(a).end() using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> P; const int INF=1e9; string tokyo="tokyo"; string kyoto="kyoto"; int main(){ int n; cin>>n; while(n--){ int cnt=0; string s; cin>>s; int i=0; while(i<s.size()){ if(s[i]=='t'){ bool f=true; REP(j,tokyo.size())if(tokyo[j]!=s[i+j])f=false; if(f){ cnt++; i+=4; } }else if(s[i]=='k'){ bool f=true; REP(j,kyoto.size())if(kyoto[j]!=s[i+j])f=false; if(f){ cnt++; i+=4; } } i++; } cout<<cnt<<endl; } }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | nishidata |
Language | C++ (GCC 4.9.2) |
Score | 100 |
Code Size | 1214 Byte |
Status | AC |
Exec Time | 33 ms |
Memory | 1016 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
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 | 33 ms | 1004 KB |
20_noised_tokyoto.txt | AC | 31 ms | 1012 KB |
99_teuchi.txt | AC | 32 ms | 1016 KB |