Submission #5548125
Source Code Expand
#include <bits/stdc++.h> #define be(v) (v).begin(),(v).end() #define pb(q) push_back(q) #define era(t) t.erase(unique(be(t)),t.end()) #define doublecout(a) cout<<fixed<<setprecision(12)<<a<<endl; typedef long long ll; using namespace std; const ll mod=1000000007,mod9=1000000009; template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));} bool solve(string s){ if(s=="kyoto"||s=="tokyo")return true; else return false; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin>>n; string s; for(int i=0;i<n;i++){ cin>>s; int ans=0; int m=s.length(); for(int j=0;j<m-4;j++){ if(s[j]=='k'||s[j]=='t'){ if(solve(s.substr(j,5))){ ans++; j+=4; } } } cout << ans<<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | shinchan |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 917 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 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 | 2 ms | 256 KB |
20_noised_tokyoto.txt | AC | 2 ms | 256 KB |
99_teuchi.txt | AC | 1 ms | 256 KB |