#include <stdio.h>
#include <string.h>
#define N 1000
#define L 1000
int code[] = { 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9 };
int main() {
static char ss[N][L + 1], s[L + 1];
int n, l, i, cnt;
scanf("%d", &n);
for (i = 0; i < n; i++) {
int h;
scanf("%s", ss[i]), l = strlen(ss[i]);
for (h = 0; h < l; h++)
ss[i][h] = code[ss[i][h] - 'a'] + '0';
}
scanf("%s", s), l = strlen(s);
cnt = 0;
for (i = 0; i < n; i++)
if (strcmp(ss[i], s) == 0)
cnt++;
printf("%d\n", cnt);
return 0;
}
Compilation message
marko.c: In function 'main':
marko.c:13:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
13 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
marko.c:17:3: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
17 | scanf("%s", ss[i]), l = strlen(ss[i]);
| ^~~~~~~~~~~~~~~~~~
marko.c:21:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
21 | scanf("%s", s), l = strlen(s);
| ^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
292 KB |
Output is correct |
4 |
Correct |
4 ms |
1484 KB |
Output is correct |
5 |
Correct |
1 ms |
460 KB |
Output is correct |
6 |
Correct |
1 ms |
460 KB |
Output is correct |
7 |
Correct |
3 ms |
1456 KB |
Output is correct |
8 |
Correct |
4 ms |
1612 KB |
Output is correct |
9 |
Correct |
1 ms |
460 KB |
Output is correct |
10 |
Correct |
3 ms |
1100 KB |
Output is correct |