Submission #3276270
Source Code Expand
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <utility> #include <cmath> #include <iomanip> using namespace std; typedef long long ll; typedef pair<int, int> ii; #define REP(i,n) for(int i=0;i<(int)(n);++i) #define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i) #define RREP(i,s,e) for(int i=(int)(s-1);i>=(int)(e);--i) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i) #define ALL(c) (c).begin(), (c).end() int main() { int t; cin>>t; REP(rep, t) { string s; cin >> s; vector<int> v; int pos = -1; while ((pos = s.find("kyoto", pos+1)) != string::npos) { v.push_back(pos); } pos = -1; while ((pos = s.find("tokyo", pos+1)) != string::npos) { v.push_back(pos); } sort(ALL(v)); int now = 0, ans = 0; FOR(i, v) { if (*i >= now) { now = *i + 5; ans++; } } cout << ans << endl; } }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | warahiko |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 1099 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 |