East 1 0 North 1 1
North East
AC码:
#include<stdio.h> int main() { int n,i,t,a; char str[8],ch[4][8]={"East","South","West","North"}; while(~scanf("%s%d",str,&n)) { for(i=0;i<4;i++) { if(str[0]==ch[i][0]) { t=i; break; } } for(i=1;i<=n;i++) { scanf("%d",&a); if(a==1) t=(t+5)%4; else t=(t+3)%4; } printf("%s\n",ch[t]); } return 0; }
[ACM] hdu 1029 Ignatius and the Princess IV (动归或hash),布布扣,bubuko.com
[ACM] hdu 1029 Ignatius and the Princess IV (动归或hash)
原文:http://blog.csdn.net/sr_19930829/article/details/24878191