HDU5292魔方满足什么条件能够还原

来源:互联网 发布:手机淘宝网触屏版官网 编辑:程序博客网 时间:2024/04/28 10:41

http://blog.sina.com.cn/s/blog_15139f1a10102vnx5.html

题解:

#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;}// r o b g w y/*g gg go o w w r ro o w w r rb bb by yy y*//*- ++ -+ - 0 0 + -- + 0 0 - +- ++ -0 00 0*/


0 0
原创粉丝点击