Submission #532954
Source Code Expand
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; char s[101]; int dp[101]; int main() { int t, i; scanf("%d", &t); for (i = 0; i < t; i++) { int n, ans = 0, j; scanf("%s", s); n = strlen(s); for (j = 0; j <= n; j++) dp[j] = 0; for (j = 4; j < n; j++) { if (strncmp(s + j - 4, "tokyo", 5) == 0 || strncmp(s + j - 4, "kyoto", 5) == 0) { if (j == 4) { dp[j] = 1; } else { dp[j] = dp[j - 5] + 1; } } else { if (j > 4) dp[j] = dp[j - 5]; } ans = max(ans, dp[j]); } printf("%d\n", ans); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | kawatea |
Language | C++ (GCC 4.9.2) |
Score | 0 |
Code Size | 872 Byte |
Status | WA |
Exec Time | 25 ms |
Memory | 800 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:14:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &t); ^ ./Main.cpp:19:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", s); ^
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 0 / 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 | WA | 25 ms | 692 KB |
20_noised_tokyoto.txt | WA | 24 ms | 800 KB |
99_teuchi.txt | WA | 23 ms | 672 KB |