about summary refs log tree commit diff
path: root/others/easy20160714/14.c
blob: fa103abbc1ccb648a7aac295aa072096d08bcbe9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>

int main()
{
	FILE *f = fopen("INP.TXT", "r");
	short n, i, a, b[10000] = {[0 ... 9999] = -1};

	fscanf(f, "%hd", &n);

	for (i = 0; i < n; i++) {
		fscanf(f, "%hd", &a);
		b[a - 1]++;
	}

	fclose(f);

	f = fopen("OUT.TXT", "w");

	for (i = 0; i < n; i++)
		if (!b[i]) {
			fprintf(f, "%hd\n", i + 1);
			break;
		}

	fclose(f);

	return 0;
}