Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这个题没办法检查啊,谁能给点数据啊?大牛们指导一下啊!#include <stdio.h> void drc(int *a,int *w) { char str[10]; int h,l; scanf("%s",str); if(str[0]=='b') { a[1]+=3; a[1]%=6; } else if(str[0]=='l') { switch(a[0]) { case 0: switch(a[1]) { case 1: a[1]=5; break; case 5: a[1]=4; break; case 4: a[1]=2; break; case 2: a[1]=1; break; } break; case 1: switch(a[1]) { case 0: a[1]=2; break; case 2: a[1]=3; break; case 3: a[1]=5; break; case 5: a[1]=0; break; } break; case 2: switch(a[1]) { case 0: a[1]=4; break; case 4: a[1]=3; break; case 3: a[1]=1; break; case 1: a[1]=0; break; } break; case 3: switch(a[1]) { case 1: a[1]=2; break; case 2: a[1]=4; break; case 4: a[1]=5; break; case 5: a[1]=1; break; } break; case 4: switch(a[1]) { case 0: a[1]=5; break; case 5: a[1]=3; break; case 3: a[1]=2; break; case 2: a[1]=0; break; } break; case 5: switch(a[1]) { case 0: a[1]=1; break; case 1: a[1]=3; break; case 3: a[1]=4; break; case 4: a[1]=0; break; } break; } } else if(str[0]=='r') { switch(a[0]) { case 0: switch(a[1]) { case 1: a[1]=5; break; case 2: a[1]=1; break; case 4: a[1]=2; break; case 5: a[1]=4; break; } break; case 1: switch(a[1]) { case 0: a[1]=5; break; case 5: a[1]=3; break; case 3: a[1]=2; break; case 2: a[1]=0; break; } break; case 2: switch(a[1]) { case 0: a[1]=1; break; case 1: a[1]=3; break; case 3: a[1]=4; break; case 4: a[1]=0; break; } break; case 3: switch(a[1]) { case 1: a[1]=5; break; case 5: a[1]=4; break; case 4: a[1]=2; break; case 2: a[1]=1; break; } break; case 4: switch(a[1]) { case 0: a[1]=2; break; case 2: a[1]=3; break; case 3: a[1]=5; break; case 5: a[1]=0; break; } break; case 5: switch(a[1]) { case 0: a[1]=4; break; case 4: a[1]=3; break; case 3: a[1]=1; break; case 1: a[1]=0; break; } break; } } else if(str[0]=='u') { h=a[0]; a[0]=(a[1]+3)%6; a[1]=h; } else if(str[0]=='d') { h=a[1]; a[1]=(a[0]+3)%6; a[0]=h; } scanf("%d",&l); switch(a[1]) { case 0: w[0]+=l; break; case 1: w[1]+=l; break; case 2: w[2]+=l; break; case 3: w[0]-=l; break; case 4: w[1]-=l; break; case 5: w[2]-=l; break; } } int main() { int a[2],w[3]; long n,t; scanf("%d",&t); while(t--) { a[0]=2; a[1]=0; w[0]=0; w[1]=0; w[2]=0; scanf("%d",&n); while(n--) { drc(a,w); } printf("%d %d %d %d\n",w[0],w[1],w[2],a[1]); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator