Submission #478881

# Submission time Handle Problem Language Result Execution time Memory
478881 2021-10-08T18:46:12 Z rainboy Elder (COCI19_elder) C
50 / 50
1 ms 208 KB
#include <stdio.h>

#define A	26

int main() {
	static char s[2], t[2], visited[A];
	int n, a_, a, b, cnt;

	scanf("%s%d", s, &n);
	a_ = s[0] - 'A', visited[a_] = 1;
	while (n--) {
		scanf("%s%s", s, t), a = s[0] - 'A', b = t[0] - 'A';
		if (b == a_)
			visited[a_ = a] = 1;
	}
	cnt = 0;
	for (a = 0; a < A; a++)
		if (visited[a])
			cnt++;
	printf("%c\n", a_ + 'A');
	printf("%d\n", cnt);
	return 0;
}

Compilation message

elder.c: In function 'main':
elder.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%s%d", s, &n);
      |  ^~~~~~~~~~~~~~~~~~~~
elder.c:12:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%s%s", s, t), a = s[0] - 'A', b = t[0] - 'A';
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct