blob: f7c2d0e98397cad2937989f08b8a77cbe145952c (
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
29
30
31
32
33
34
35
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *f = fopen("INP.TXT", "r");
int n, k, *a, i;
long long s = 0;
fscanf(f, "%d %d", &n, &k);
a = malloc(n * sizeof(int));
for (i = 0; i < n; i++) {
fscanf(f, "%d", a + i);
s += a[i];
}
fclose(f);
k = s / k;
s = 0;
for (i = 0; i < n; i++) {
s += a[i];
if (s == k)
s = 0;
}
f = fopen("OUT.TXT", "w");
fputs(s ? "NO\n" : "YES\n", f);
fclose(f);
return 0;
}
|