标签:nyoj笨蛋的难题一
East 1 0 North 1 1
North East
#include<cstdio> #include<cstdlib> #include<cstring> using namespace std; int main() { int i,a,n; char s[10]; while(scanf("%s %d",s,&n)!=EOF){ if(strcmp(s,"East")==0)a=1; else if(strcmp(s,"West")==0)a=3; else if(strcmp(s,"North")==0)a=4; else if(strcmp(s,"South")==0)a=2; while(n--){ scanf("%d",&i); if(i==1)a=a+1; else if(i==0)a=a-1; if(a==5)a=1; if(a==0)a=4; } if(a==1)printf("East\n"); else if(a==2)printf("South\n"); else if(a==3)printf("West\n"); else if(a==4)printf("North\n"); } return 0; }
标签:nyoj笨蛋的难题一
原文地址:http://blog.csdn.net/r1986799047/article/details/43486437