complete 14425.c

This commit is contained in:
2024-04-30 11:03:16 +09:00
parent 19abf1dbd8
commit d6ee73729b
2 changed files with 40 additions and 21 deletions

View File

@@ -1,21 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
int N, M;
scanf("%d %d", &N, &M);
char S[N][501];
char check[M][501];
for (int i = 0; i < N; i++) {
scanf("%s", &S[i]);
}
for (int i = 0; i < M; i++) {
scanf("%s", &check[i]);
}
return 0;
}

40
zeta_C/completed/14425.c Normal file
View File

@@ -0,0 +1,40 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int STR_LEN = 501;
int is_in(char *a, char (*S)[STR_LEN], int N) {
for (int i = 0; i < N; i++) {
int c = strcmp(a, S[i]);
if (c == 0) {
return 1;
}
}
return 0;
}
int main() {
int N, M;
scanf("%d %d", &N, &M);
char S[N][STR_LEN];
char check[M][STR_LEN];
for (int i = 0; i < N; i++) {
scanf("%s", (S[i]));
}
for (int i = 0; i < M; i++) {
scanf("%s", (check[i]));
}
int count = 0;
for (int i = 0; i < M; i++) {
count += is_in((check[i]), S, N);
}
printf("%d\n", count);
return 0;
}