blob: 4f013546031ce8cfcf5105823ded476baaaf26f4 (
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
|
#include <stdio.h>
#include <stdlib.h>
int main (void) {
char b[64];
unsigned m = 0;
unsigned n = 0;
unsigned o = 0;
unsigned s = 0;
while (!ferror(stdin) && !feof(stdin)) {
fgets(b, 64, stdin);
if (b[0] == '\n') {
if (s > m) {
o = n;
n = m;
m = s;
goto c;
}
if (s > n) {
o = n;
n = s;
goto c;
}
if (s > o) {
o = s;
goto c;
}
c:
s = 0;
} else {
s += atoi(b);
}
}
printf("%u %u %u sum %u\n", m, n, o, m+n+o);
}
|