Submission #532926
Source Code Expand
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
int main() {
int T;
scanf("%d", &T);
for(int ii = 0; ii < T; ++ ii) {
string S;
cin >> S;
int n = S.size();
vi dp(n+1);
dp[0] = 0;
rep(i, n) {
int x = dp[i];
amax(dp[i + 1], x);
if(S.substr(i, 5) == "tokyo")
amax(dp[i + 5], x + 1);
if(S.substr(i, 5) == "kyoto")
amax(dp[i + 5], x + 1);
}
cout << dp[n] << endl;
}
return 0;
}
Submission Info
Submission Time
2015-10-24 13:22:08+0900
Task
A - 東京都
User
anta
Language
C++11 (GCC 4.9.2)
Score
100
Code Size
1595 Byte
Status
AC
Exec Time
30 ms
Memory
928 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:40:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &T);
^
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
30 ms
928 KB
20_noised_tokyoto.txt
AC
27 ms
796 KB
99_teuchi.txt
AC
27 ms
796 KB