diff options
Diffstat (limited to 'others/easy20160714/11.c')
-rw-r--r-- | others/easy20160714/11.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/others/easy20160714/11.c b/others/easy20160714/11.c new file mode 100644 index 0000000..61238ef --- /dev/null +++ b/others/easy20160714/11.c @@ -0,0 +1,31 @@ +#include <stdio.h> + +int main() +{ + FILE *f = fopen("INP.TXT", "r"); + short n, i, a; + char b[10000] = {}; + + fscanf(f, "%hd", &n); + + for (i = 0; i < n; i++) { + fscanf(f, "%hd", &a); + if (a <= n) + b[a - 1] = 1; + } + + fclose(f); + + a = 1; + for (i = 0; i < n; i++) + if (!b[i]) { + a = 0; + break; + } + + f = fopen("OUT.TXT", "w"); + fputs(a ? "YES\n" : "NO\n", f); + fclose(f); + + return 0; +} |