Submission #532949
Source Code Expand
#include <bits/stdc++.h> #define FOR(i,a,b) for( int i = (a); i < (int)(b); i++ ) #define REP(i,n) FOR(i,0,n) #define REPR(x,arr) for(auto& x:arr) #define ALL(x) (x).begin(),(x).end() #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; typedef long long int ll; typedef pair<ll,ll> P; typedef vector<ll> vec; const int INF = 1e9; const ll INFLL = 1e18; const double EPS = 1e-8; template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); } template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); } ll in(){ ll a; cin >> a; return a; } string s; string tokyo = "tokyo"; string kyoto = "kyoto"; int main(){ int n = in(); REP( loop , n ){ cin >> s; int ans = 0; for( int i = 0; i < s.size(); i++ ){ if( s.substr( i , 5 ) == tokyo || s.substr( i , 5 ) == kyoto ){ ans++; i += 4; } } cout << ans << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | joisino |
Language | C++11 (GCC 4.9.2) |
Score | 100 |
Code Size | 999 Byte |
Status | AC |
Exec Time | 31 ms |
Memory | 928 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 | 31 ms | 928 KB |
20_noised_tokyoto.txt | AC | 28 ms | 928 KB |
99_teuchi.txt | AC | 27 ms | 820 KB |