This commit is contained in:
Misaka Mikoto 2020-12-06 18:26:56 +02:00
parent 702dba36a6
commit 0be9ecb987
4 changed files with 2281 additions and 0 deletions

2197
2020/6 Normal file

File diff suppressed because it is too large Load Diff

42
2020/6-1.c Normal file
View File

@ -0,0 +1,42 @@
#include <stdio.h>
#include <string.h>
int
main (void)
{
freopen ("6", "r", stdin);
int out = 0;
int c = 0;
while (c != EOF) { /* group */
unsigned char x[26];
memset(x, 1, sizeof x);
while (c != EOF) { /* person */
unsigned char y[26] = {0};
int tmp;
do { /* character */
c = getchar ();
if (c == EOF || c == '\n')
break;
y[c - 'a'] = 1;
} while (1);
for (int i = 0; i < sizeof y / sizeof y[0]; i++)
x[i] &= y[i];
tmp = getchar();
if (tmp == '\n')
break;
else if (tmp == EOF)
c = EOF;
else
ungetc(tmp, stdin);
}
for (int i = 0; i < sizeof x / sizeof x[0]; i++)
out += x[i];
}
printf ("%d\n", out);
return 0;
}

27
2020/6.c Normal file
View File

@ -0,0 +1,27 @@
#include <stdio.h>
int
main (void)
{
freopen ("6", "r", stdin);
int out = 0;
int c = 0;
while (c != EOF) {
int y[26] = {0};
while (c != EOF) {
c = getchar ();
if (c == '\n')
{
c = getchar ();
if (c == '\n')
break;
}
if (c != EOF) /* else intentionally not used */
y[c - 'a'] = 1;
}
for (int i = 0; i < sizeof y / sizeof y[0]; i++)
out += y[i];
}
printf ("%d\n", out);
return 0;
}

15
2020/6test Normal file
View File

@ -0,0 +1,15 @@
abc
a
b
c
ab
ac
a
a
a
a
b