NYOJ624 笨蛋的难题(一)

来源:互联网 发布:西门子plc编程数据线 编辑:程序博客网 时间:2024/04/28 02:19

原题链接


#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;}


0 0