Submission #2975745
Source Code Expand
#include <iostream> #include <string> #include <queue> #include <vector> #include <set> #include <map> #include <algorithm> #include <utility> #include <iomanip> #define ll long long int #define pb push_back #define mk make_pair #define pq priority_queue using namespace std; typedef pair<int, int> P; typedef pair<ll, int> Pl; const int inf = 1e9; const ll linf = 1LL << 50; int main(int argc, char const* argv[]) { int t; cin >> t; for(int i = 0; i < t; i++){ string s; cin >> s; vector<int> vec; for(int j = 0; j + 4 < s.size(); j++){ if(s.substr(j, 5) == "tokyo" || s.substr(j, 5) == "kyoto"){ vec.pb(j + 4); } } int res = 0; int curr = -1; for(auto itr = vec.begin(); itr != vec.end(); ++itr){ if(curr < (*itr) - 4){ res++; curr = (*itr); } } cout << res << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | fumiphys |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 908 Byte |
Status | AC |
Exec Time | 3 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 | 3 ms | 256 KB |
20_noised_tokyoto.txt | AC | 3 ms | 256 KB |
99_teuchi.txt | AC | 2 ms | 256 KB |