NYOJ624 笨蛋的难题(一)
#include <stdio.h> char *str[] = {"East", "South", "West", "North"}, buf[10]; int main(){ int s, n, i, t; while(scanf("%s%d", buf, &n) == 2){ s = 0; while(n-- && scanf("%d", &t)) s += (t ? 1 : -1); s %= 4; switch(buf[0]){ case 'E': i = 0; break; case 'S': i = 1; break; case 'W': i = 2; break; case 'N': i = 3; break; } i += 4; i += s; puts(str[i % 4]); } return 0; }