1 条题解

  • 0
    @ 2023-10-6 10:42:30
    int main()
    {
        int t;
        long long x=0,y=0,z=0;
        int top=0,r=1,l=4,u=2,d=5,b=3;
    	scanf("%d",&t);
    	while(t--){
    		char s[2];
    		int n;
    		scanf("%s %d",s,&n);
    		char a = s[0];
    		if( a=='b'){
    			int re=l; l=r; r=re;
    			re=top; top=b; b=re;
    		}else if( a=='l'){
    			int re=top; top=l; l=b; b=r; r=re;
    		}else if( a=='r'){
    			int re=top; top=r; r=b; b=l; l=re;
    		}else if( a=='u'){
    			int re=top; top=u; u=b; b=d; d=re;
    		}else if( a=='d'){
    			int re=top; top=d; d=b; b=u; u=re;
    		}
    		if(top==0){
    			x+=n;
    		}else if(top==1){
    			y+=n;
    		}else if(top==2){
    			z+=n;
    		}else if(top==3){
    			x-=n;
    		}else if(top==4){
    			y-=n;
    		}else if(top==5){
    			z-=n;
    		}
    	//	printf("%lld %lld %lld %d\n",x,y,z,top);
    	}	
     	printf("%lld %lld %lld %d",x,y,z,top);
    	return 0;
    }
    
    • 1

    信息

    ID
    240
    时间
    1000ms
    内存
    256MiB
    难度
    9
    标签
    (无)
    递交数
    196
    已通过
    10
    上传者