aboutsummaryrefslogtreecommitdiff
path: root/2023/15/15a.c
blob: 16a8fec1c3bc79d61f64070fff8113286473066c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>

#define N 100000

char *b, line[N];
int c, s;

int main() {
	fgets(line, N, stdin);

	for (b = line, c = 0, s = 0; *b; b++) {
		if (*b == ',' || *b == '\n') {
			s += c;
			c = 0;
		} else
			c = (c + (int)*b) * 17 % 256;
	}

	printf("%d\n", s);
	return 0;
}

Generated with cgit - Back to sebastiano.tronto.net