Submission #2635386
Source Code Expand
#include<cstdio> bool is_equal(char a[],char b[]) { int i; for(i = 0;a[i] != '\0' && b[i] != '\0';i++) { if(a[i] != b[i]) return false; } return a[i] == b[i]; } int main() { int t; scanf("%d",&t); char a[] = "kyoto"; char b[] = "tokyo"; for(int i = 0;i < t;i++) { char s[200]; scanf("%s",s); int n = 0; for(;s[n] != '\0';n++); int c = 0; for(int j = 0;j < n - 4;j++) { char r[10]; for(int k = 0;k < 5;k++) r[k] = s[j + k]; r[5] = '\0'; if(is_equal(r,a) || is_equal(r,b)){ c++; j += 4; } } printf("%d\n",c); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | kyawakyawa |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 625 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:14:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&t); ^ ./Main.cpp:21:16: 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 | 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 | 1 ms | 128 KB |
20_noised_tokyoto.txt | AC | 1 ms | 128 KB |
99_teuchi.txt | AC | 1 ms | 128 KB |