Submission #533075
Source Code Expand
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int MAXN = 1E2 + 10; char s[MAXN]; int f[MAXN]; int main(){ int cas; scanf("%d", &cas); while (cas--){ scanf("%s", s + 1); int n = strlen(s + 1); for (int i = 0; i < 5; ++i) f[i] = 0; char s1[10]; s1[5] = 0; for (int i = 5; i <= n; ++i){ f[i] = f[i - 1]; strncpy(s1, s + i - 4, 5); if (!strcmp(s1, "tokyo") || !strcmp(s1, "kyoto")) f[i] = max(f[i], f[i - 5] + 1); } printf("%d\n", f[n]); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | sfiction |
Language | C++ (GCC 4.9.2) |
Score | 100 |
Code Size | 559 Byte |
Status | AC |
Exec Time | 25 ms |
Memory | 804 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:14:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &cas); ^ ./Main.cpp:16:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", s + 1); ^
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 | 25 ms | 804 KB |
20_noised_tokyoto.txt | AC | 23 ms | 796 KB |
99_teuchi.txt | AC | 25 ms | 784 KB |