Submission #2201183
Source Code Expand
#include <bits/stdc++.h> using namespace std; string s; string to = "tokyo", ky = "kyoto"; int main(){ int n; cin >> n; for(int i = 0; i < n; i++){ cin >> s; s += "0000000"; int ans = 0; bool flag = true; for(int i = 0; i < s.length()-5; i++){ if(s[i] == 't'){ flag = true; for(int j = 0; j <to.length(); j++){ if(s[i+j] != to[j]) flag = false; } if(flag){ ++ans; for(int j = 0; j <to.length(); j++) s[i+j] = '0'; } } else if(s[i] == 'k'){ flag = true; for(int j = 0; j <to.length(); j++){ if(s[i+j] != ky[j]) flag = false; } if(flag){ ++ans; for(int j = 0; j <to.length(); j++) s[i+j] = '0'; } } } cout << ans << endl; } }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | m0bec |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 957 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 |