#include #include #include int main(void) { char *s = "L68\nL30\nR48\nL5\nR60\nL55\nL1\nL99\nR14\nL82\n"; /*char b[17100]; bzero(b, 17100); FILE *f = fopen("input", "r"); fread(b, 1, 17100, f); char *s = b;*/ int i = 0; int c = 0; int p = 50; while(*s) { if (s[0] == 'R') p = (p + atoi(&s[1])) % 100; else if (s[0] == 'L') p = (p - atoi(&s[1])) % 100; if (p == 0) c++; while (s[0] != '\n') s++; s++; } printf("result : %d\n", c); }