亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

HDU 5983 Pocket Cube (簡單模擬)

2019-11-11 05:11:38
字體:
來源:轉載
供稿:網友

大體題意:

給你一個2*2*2的魔方,問你能否一步到達各個面的顏色完全一樣。

思路:

其實挺簡單的,題意已經給足了提示,已經告訴你了魔方怎么進行標號。(就是那個圖)

只要給魔方標號,怎么轉就很簡單了,可以預處理一個b 數組和c 數組,分別是魔方轉一個面時候的側面的八個面和上面的四個面,循環賦值即可。

這樣 寫好循環賦值函數后,轉六個面只需要更改b數組和c數組即可。

詳細見代碼:

#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int a[25];bool ok;int ori[25];void fuyuan(){    for (int i = 0; i < 24; ++i) a[i] = ori[i];}bool check(){    for (int i = 0; i < 24; i += 4){        for (int j = i; j < i+4; ++j){            if (a[j] != a[i]) return false;        }    }    return true;}int b[] = {14,15,20,22,5,4,19,17};int c[] = {2,3,1,0};void zhuan(){    int t1 = a[b[0]], t2 = a[b[1]];    for (int i = 0; i < 6; i += 2){        int id1 = b[i], id2 = b[i+1];        int nid1 = b[i+2], nid2 = b[i+3];        a[id1] = a[nid1];        a[id2] = a[nid2];    }    a[b[6] ] = t1; a[b[7] ] = t2;    if (check()) ok = 1;fuyuan();    t1 = a[b[7]], t2 = a[b[6]];    for (int i = 7; i > 2; i -= 2){        int id1 = b[i], id2 = b[i-1];        int nid1 = b[i-2], nid2 = b[i-3];        a[id1] = a[nid1];        a[id2] = a[nid2];    }    a[b[0] ] = t2; a[b[1] ] = t1;    if (check()) ok = 1; fuyuan();}void add(int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int c0,int c1,int c2,int c3){    b[0] = a0;b[1] = a1;b[2] = a2;b[3] = a3;b[4] = a4;b[5] = a5;b[6] = a6;b[7] = a7;    c[0] = c0;c[1] = c1;c[2] = c2;c[3] = c3;}void up(){    add(14,15,20,22,5,4,19,17,2,3,1,0);    zhuan();}void down(){    add(12,13,21,23,7,6,18,16,8,9,11,10);    zhuan();}void Left(){    add(2,0,14,12,10,8,6,4,19,17,18,16);    zhuan();}void Right(){    add(3,1,15,13,11,9,7,5,20,22,23,21);    zhuan();}void qian(){    add(0,1,20,21,11,10,16,17,14,15,13,12);    zhuan();}void hou(){    add(2,3,22,23,9,8,18,19,4,5,6,7);    zhuan();}int main(){    int T;    scanf("%d",&T);    while(T--){        ok = 0;        for (int i = 0; i < 24; ++i) scanf("%d",a+i);        for (int i = 0; i < 24; ++i)ori[i] = a[i];        if (check()) ok = 1;        up(); down(); Left(); Right(); qian(); hou();        if (ok)puts("YES");        else puts("NO");    }    return 0;}

Pocket Cube

Time Limit: 2000/1000 MS (java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 358    Accepted Submission(s): 131PRoblem DescriptionThe Pocket Cube, also known as the Mini Cube or the Ice Cube, is the 2 × 2 × 2 equivalence of a Rubik’s Cube.The cube consists of 8 pieces, all corners.Each piece is labeled by a three dimensional coordinate (h, k, l) where h, k, l ∈ {0, 1}. Each of the six faces owns four small faces filled with a positive integer.For each step, you can choose a certain face and turn the face ninety degrees clockwise or counterclockwise.You should judge that if one can restore the pocket cube in one step. We say a pocket cube has been restored if each face owns four same integers. InputThe first line of input contains one integer N(N ≤ 30) which is the number of test cases.For each test case, the first line describes the top face of the pocket cube, which is the common 2 × 2 face of pieceslabelled by (0, 0, 1),(0, 1, 1),(1, 0, 1),(1, 1, 1). Four integers are given corresponding to the above pieces.The second line describes the front face, the common face of (1, 0, 1),(1, 1, 1),(1, 0, 0),(1, 1, 0). Four integers aregiven corresponding to the above pieces.The third line describes the bottom face, the common face of (1, 0, 0),(1, 1, 0),(0, 0, 0),(0, 1, 0). Four integers aregiven corresponding to the above pieces.The fourth line describes the back face, the common face of (0, 0, 0),(0, 1, 0),(0, 0, 1),(0, 1, 1). Four integers aregiven corresponding to the above pieces.The fifth line describes the left face, the common face of (0, 0, 0),(0, 0, 1),(1, 0, 0),(1, 0, 1). Four integers are givencorresponding to the above pieces.The six line describes the right face, the common face of (0, 1, 1),(0, 1, 0),(1, 1, 1),(1, 1, 0). Four integers are givencorresponding to the above pieces.In other Words, each test case contains 24 integers a, b, c to x. You can flat the surface to get the surface developmentas follows.
+ - + - + - + - + - + - +| q | r | a | b | u | v |+ - + - + - + - + - + - +| s | t | c | d | w | x |+ - + - + - + - + - + - +        | e | f |        + - + - +        | g | h |        + - + - +        | i | j |        + - + - +        | k | l |        + - + - +        | m | n |        + - + - +        | o | p |        + - + - + OutputFor each test case, output YES if can be restored in one step, otherwise output NO. Sample Input
41 1 1 12 2 2 23 3 3 34 4 4 45 5 5 56 6 6 66 6 6 61 1 1 12 2 2 23 3 3 35 5 5 54 4 4 41 4 1 42 1 2 13 2 3 24 3 4 35 5 5 56 6 6 61 3 1 32 4 2 43 1 3 14 2 4 25 5 5 56 6 6 6 Sample Output
YESYESYESNO Source2016ACM/ICPC亞洲區青島站-重現賽(感謝中國石油大學) Recommendjiangzijing2015   |   We have carefully selected several similar problems for you:  6014 6013 6012 6011 6010  


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
精品福利视频导航| 日韩成人网免费视频| 国产美女久久精品| 欧美激情在线观看| 国产91|九色| 视频一区视频二区国产精品| 亚洲伊人成综合成人网| 国产精品日韩欧美综合| 91精品久久久久久久久久久久久久| 成人淫片在线看| 亚洲伊人成综合成人网| 国产又爽又黄的激情精品视频| 国产综合视频在线观看| 中日韩美女免费视频网站在线观看| 96pao国产成视频永久免费| 日韩在线观看高清| 91色在线观看| 日韩激情av在线播放| 国产精品av在线播放| 成人情趣片在线观看免费| 日韩中文字幕精品视频| 欧美性生活大片免费观看网址| 精品久久久久久久久久国产| 色综合久久久久久中文网| 欧美国产日韩一区| 国产成人午夜视频网址| 欧美一级大片在线免费观看| 57pao成人国产永久免费| 中文字幕在线观看亚洲| 亚洲国产精品久久久久秋霞不卡| 不卡伊人av在线播放| 久久精品2019中文字幕| 国产精品三级网站| 麻豆国产va免费精品高清在线| 国产精品入口免费视频一| 91精品视频在线免费观看| 亚洲在线免费视频| 国产视频久久网| 最近2019中文字幕第三页视频| 日韩av一区二区在线| 国产91精品久| 精品久久中文字幕| 成人黄色网免费| 亚洲成av人乱码色午夜| 欧美夜福利tv在线| 亚洲桃花岛网站| 久久久91精品国产一区不卡| 国产精品99久久99久久久二8| 欧美亚洲伦理www| 欧美疯狂做受xxxx高潮| 亚洲欧美日韩精品久久| www.久久草.com| 国产亚洲欧美一区| 亚洲bt天天射| 中文字幕日韩综合av| 97香蕉久久超级碰碰高清版| 中文字幕国内精品| 亚洲午夜色婷婷在线| 国产精品揄拍500视频| 清纯唯美日韩制服另类| 国内成人精品一区| 欧美午夜精品久久久久久久| 性欧美办公室18xxxxhd| 国产日韩精品在线播放| 欧美精品videos性欧美| 亚洲999一在线观看www| 国产精品成人va在线观看| 欧美电影在线观看| 91sao在线观看国产| 91在线色戒在线| 91久久国产精品91久久性色| 国产精品中文字幕久久久| 一区二区亚洲欧洲国产日韩| 亚洲九九九在线观看| 亚洲国产精品电影在线观看| 中文字幕一区电影| 欧美色视频日本高清在线观看| 亚洲乱码一区av黑人高潮| 91夜夜揉人人捏人人添红杏| 北条麻妃一区二区在线观看| 国产亚洲视频在线| 亚洲免费精彩视频| 欧美xxxx18国产| 中文字幕综合一区| 久久精品一本久久99精品| 一区二区成人av| 永久免费看mv网站入口亚洲| 国产精品亚洲一区二区三区| 91高清视频在线免费观看| 久久精品影视伊人网| 九九久久国产精品| 精品一区电影国产| 亚洲美女精品成人在线视频| 久久不射热爱视频精品| 久久久久久久久久国产| 亚洲精品视频网上网址在线观看| 亚洲男人av电影| 日韩成人av一区| 国产精品wwww| 欧美精品一本久久男人的天堂| 日韩av在线网址| 亚洲国模精品私拍| 91精品综合久久久久久五月天| 国产69久久精品成人| 日韩国产一区三区| 国产成人一区二区在线| 97精品国产91久久久久久| 日韩一区二区在线视频| 26uuu另类亚洲欧美日本老年| 在线观看日韩www视频免费| 国内揄拍国内精品| 久久精品色欧美aⅴ一区二区| 国产精品影院在线观看| 欧美日韩一区二区三区在线免费观看| 中文字幕亚洲色图| 欧美大秀在线观看| 欧美一级高清免费播放| 欧美日韩免费区域视频在线观看| 18性欧美xxxⅹ性满足| 亚洲无亚洲人成网站77777| 亚洲爱爱爱爱爱| 亚洲精品国偷自产在线99热| 69av成年福利视频| 久久精品中文字幕免费mv| 韩国19禁主播vip福利视频| 亚洲精品97久久| 成人444kkkk在线观看| 国产精品久久久久久亚洲影视| 亚洲精品一区久久久久久| 欧美日韩亚洲激情| 91po在线观看91精品国产性色| 全亚洲最色的网站在线观看| 国产综合香蕉五月婷在线| 成人免费视频xnxx.com| 欧美视频不卡中文| 国产亚洲欧洲黄色| 亚洲性生活视频| 亚洲天堂av高清| 日本乱人伦a精品| 欧美中文字幕视频| 国产精品视频精品视频| 欧美裸体男粗大视频在线观看| 国产不卡视频在线| 91av在线网站| 91中文字幕一区| 欧美日韩综合视频网址| 亚洲2020天天堂在线观看| 久久99精品久久久久久青青91| 欧美一级在线播放| 欧美视频精品一区| 青青青国产精品一区二区| 国产视频精品免费播放| 国产精品欧美日韩一区二区| 中文字幕在线看视频国产欧美在线看完整| 97人人做人人爱| 久久天天躁狠狠躁夜夜爽蜜月| 亚洲综合色av| 国产日韩在线看片| 68精品久久久久久欧美| 国产91成人video| 国产精品久久久久久亚洲影视| 精品久久久久久久久国产字幕| 最近的2019中文字幕免费一页| 亚洲在线观看视频网站|