#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) { int m = atoi(&s[1]); if (s[0] == 'R') { while (m) { p = (p + 1) % 100; if (p == 0) c++; m--; } } else if (s[0] == 'L') { while (m) { p = (p - 1) % 100; if (p == 0) c++; m--; } } while (s[0] != '\n') s++; s++; } printf("result : %d\n", c); }