PersonalCorpus 版 (精华区)
1228411 Big Guava ... 10409 Accepted
0:00.002 64 2002/11/11 02:08:14.244
void main()
{
#ifndef ONLINE_JUDGE
freopen("k:\\iG","r",stdin);
freopen("k:\\oG","w",stdout);
#endif
int i,j,k,m,n,c[6];
char s[20];
while (1) {
scanf("%d\n",&n);
if (n==0) break;
c[0]=6; c[1]=2; c[2]=4; c[3]=1; c[4]=5; c[5]=3;
while (n--) {
gets(s);
if (strcmp(s,"north")==0) {
k=c[1]; c[1]=c[3]; c[3]=c[4]; c[4]=c[0]; c[0]=k;
continue;
}
if (strcmp(s,"south")==0) {
k=c[1]; c[1]=c[0]; c[0]=c[4]; c[4]=c[3]; c[3]=k;
continue;
}
if (strcmp(s,"east")==0) {
k=c[2]; c[2]=c[3]; c[3]=c[5]; c[5]=c[0]; c[0]=k;
continue;
} else {
k=c[2]; c[2]=c[0]; c[0]=c[5]; c[5]=c[3]; c[3]=k;
}
}
printf("%d\n",c[3]);
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.929毫秒