Submission #5413856
Source Code Expand
#include <bits/stdc++.h> using namespace std; string S; bool ok(int n){ //S.at(n)から始まる tokyoかkyotoがある. bool flag=false; if(S.at(n)=='t' && S.at(n+1)=='o' && S.at(n+2)=='k' && S.at(n+3)=='y' && S.at(n+4)=='o' ) flag =true; if(S.at(n)=='k' && S.at(n+1)=='y' && S.at(n+2)=='o' && S.at(n+3)=='t' && S.at(n+4)=='o' ) flag =true; return flag; } int main(){ int T; cin >> T; for(int i=0; i<T; i++){ cin >> S; int cnt =0; int j=0; while(j< (int) S.size()-4){ if(ok(j)){ cnt++; j +=5; } else j++; } cout << cnt << endl; } }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | flowsignal |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 728 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 |