Pocket Cube

看了别人的,mark一下

#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

int a[] = {-1,1,1,-1,1,-1,0,0,1,-1,-1,1,0,0,-1,1,-1,1,1,-1,0,0,0,0};
int T;
int main(){
    scanf("%d",&T);
    for(int re=1;re<=T;++re){
        int ans = 0;
        char ch[3];
        for(int i=0;i<24;++i){
            scanf("%s",ch);
            if(ch[0] == 'w' || ch[0] == 'y')
                ans += a[i];
        }
        printf("Case #%d: %s\n",re,ans%3?"NO":"YES");
    }
    return 0;
}

你可能感兴趣的:(魔方)