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"); char a; short n, m; fscanf(f, "%hd", &n); m = n / 2; for (; n; n--) { fscanf(f, "%hhd", &a); if (a == 1) m--; } fclose(f); f = fopen("OUT.TXT", "w"); fputs((m < 0) ? "YES\n" : "NO\n", f); fclose(f); return 0; }