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

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

HDU 5983 Pocket Cube (簡單模擬)

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

大體題意:

給你一個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
中文字幕欧美视频在线| 亚洲久久久久久久久久久| 国产suv精品一区二区三区88区| 青青草原成人在线视频| 亚洲精品xxx| 91系列在线观看| 欧美诱惑福利视频| 日韩成人在线视频网站| 久久亚洲欧美日韩精品专区| 欧美极品xxxx| 亚洲黄页视频免费观看| 亚洲精品电影久久久| 欧美亚洲在线视频| 欧美精品情趣视频| 欧美精品免费在线| 欧美黄色片免费观看| 插插插亚洲综合网| 欧美激情性做爰免费视频| 亚洲第一精品夜夜躁人人爽| 国产精品久久久久久中文字| 国产成人精品免高潮在线观看| 色综合91久久精品中文字幕| 91嫩草在线视频| 国产一区二区美女视频| 国产精自产拍久久久久久| 色婷婷av一区二区三区在线观看| 欧美激情中文字幕乱码免费| 黄色成人av在线| 久久综合久久八八| 日韩在线观看免费全集电视剧网站| 伊人男人综合视频网| 国产精品一二三在线| 日韩av在线资源| 久久久久一本一区二区青青蜜月| 九九九热精品免费视频观看网站| 国产热re99久久6国产精品| 国产精品av免费在线观看| 欧美性色视频在线| 久久久久久久久91| 日韩在线观看精品| 日韩激情片免费| 欧美理论电影在线播放| 亚洲女性裸体视频| 久久亚洲精品毛片| 欧美日韩激情小视频| 亚洲欧美制服丝袜| 久久精视频免费在线久久完整在线看| 国产成人aa精品一区在线播放| 日韩中文字幕在线精品| 午夜精品久久久久久久男人的天堂| 97国产精品视频人人做人人爱| 91精品久久久久| 中文在线资源观看视频网站免费不卡| 亚洲国产精品一区二区三区| 国产91在线播放九色快色| 国产精品国产三级国产aⅴ浪潮| 日日骚av一区| 久久久久久久网站| 精品偷拍各种wc美女嘘嘘| 91精品久久久久久综合乱菊| 91精品国产综合久久久久久久久| 日本精品免费一区二区三区| 成人激情综合网| 久久精品小视频| 日韩精品在线观看一区二区| 91av视频在线| 欧美另类高清videos| 欧美精品国产精品日韩精品| 中文字幕精品在线| 亚洲精品视频免费在线观看| 精品日韩视频在线观看| 91精品在线观| 午夜精品久久久久久久久久久久| 欧美亚洲国产另类| 九九久久综合网站| 国产日韩av在线播放| 91精品国产综合久久久久久蜜臀| 日韩精品在线视频| 久久久久北条麻妃免费看| 91av视频在线| 国产欧美久久久久久| 亚洲欧美视频在线| 久久香蕉国产线看观看网| 久久精品精品电影网| 久久夜色精品亚洲噜噜国产mv| 亚洲wwwav| 国产美女高潮久久白浆| 日韩欧美精品在线观看| 久久久国产精品视频| 92国产精品视频| 国产亚洲精品美女久久久| 亚洲男人天堂久| 国产精品久久久久影院日本| www.亚洲男人天堂| 97视频在线观看免费| 91在线无精精品一区二区| 国内揄拍国内精品少妇国语| 欧美成人黑人xx视频免费观看| 91香蕉嫩草影院入口| 精品露脸国产偷人在视频| 精品国产91久久久久久| 亚洲免费高清视频| 日本久久亚洲电影| 九九精品视频在线观看| 久久99亚洲热视| 久久久欧美一区二区| 91香蕉嫩草神马影院在线观看| 日韩精品视频免费在线观看| 成人信息集中地欧美| 亚洲精品中文字幕av| 亚洲精品理论电影| www亚洲精品| 国产一区二区三区三区在线观看| 成年无码av片在线| 久久久久久久999| 色999日韩欧美国产| 成人综合网网址| 青青草原成人在线视频| 91国语精品自产拍在线观看性色| 亚洲精品国产拍免费91在线| 欧美大成色www永久网站婷| 97精品国产aⅴ7777| 日韩av三级在线观看| 98精品在线视频| 国产精品久久久久久av福利| 国内精品国产三级国产在线专| 国产成人精品免高潮费视频| 亚洲精品国偷自产在线99热| 欧美日韩电影在线观看| 成人乱色短篇合集| 久久婷婷国产麻豆91天堂| 国产精品久久久久影院日本| 久久99视频精品| 成人福利在线视频| 欧美成在线视频| 欧美老女人性视频| 国产在线观看一区二区三区| 久久亚洲精品一区二区| 亚洲无线码在线一区观看| 亚洲a在线播放| 国产精品香蕉在线观看| 国内成人精品一区| 精品视频偷偷看在线观看| 日韩影视在线观看| 91在线高清视频| 国产91ⅴ在线精品免费观看| 欧美日韩精品在线观看| 国产精品日本精品| 国产精品久久久久久久久免费| 国产视频精品久久久| 欧美精品18videos性欧美| 琪琪亚洲精品午夜在线| 欧美插天视频在线播放| 成人精品一区二区三区电影免费| 久久青草精品视频免费观看| 日本三级韩国三级久久| 欧美性极品xxxx娇小| 欧美日韩中文字幕| 国产精品久久久久福利| 国产亚洲精品日韩| 欧美日韩第一页| 精品福利在线观看| 亚洲奶大毛多的老太婆| 国产精品久久久久久久av电影|