15a.c (279B)
1 #include <stdio.h> 2 3 #define N 100000 4 5 char *b, line[N]; 6 int c, s; 7 8 int main() { 9 fgets(line, N, stdin); 10 11 for (b = line, c = 0, s = 0; *b; b++) { 12 if (*b == ',' || *b == '\n') { 13 s += c; 14 c = 0; 15 } else 16 c = (c + (int)*b) * 17 % 256; 17 } 18 19 printf("%d\n", s); 20 return 0; 21 }