首页 > 代码库 > hdu 5012 bfs 康托展开

hdu 5012 bfs 康托展开

Dice

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 491    Accepted Submission(s): 290

Problem Description
   There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a1.a2,a3,a4,a5,a6 to be numbers written on top face, bottom face, left face, right face, front face and back face of dice A. Similarly, consider b1.b2,b3,b4,b5,b6 to be numbers on specific faces of dice B. It’s guaranteed that all numbers written on dices are integers no smaller than 1 and no more than 6 while ai ≠ aj and bi ≠ bj for all i ≠ j. Specially, sum of numbers on opposite faces may not be 7.
   At the beginning, the two dices may face different(which means there exist some i, ai ≠ bi). Ddy wants to make the two dices look the same from all directions(which means for all i, ai = bi) only by the following four rotation operations.(Please read the picture for more information)
   Now Ddy wants to calculate the minimal steps that he has to take to achieve his goal.
 
Input
   There are multiple test cases. Please process till EOF.
   For each case, the first line consists of six integers a1,a2,a3,a4,a5,a6, representing the numbers on dice A.
   The second line consists of six integers b1,b2,b3,b4,b5,b6, representing the numbers on dice B.
 
Output
   For each test case, print a line with a number representing the answer. If there’s no way to make two dices exactly the same, output -1.
 
Sample Input
1 2 3 4 5 61 2 3 4 5 61 2 3 4 5 61 2 5 6 4 31 2 3 4 5 61 4 2 5 3 6
 
Sample Output
03-1
 
Source
2014 ACM/ICPC Asia Regional Xi‘an Online
 
Recommend
hujie   |   We have carefully selected several similar problems for you:  5017 5016 5014 5013 5011 
 

卜神的代码

为了测试康托展开, 文中注释部分是卜神原来的代码,也是ac的。

 

  1 #include <iostream>  2 #include <cstdio>  3 #include <cstring>  4 #include <queue>  5 #include <algorithm>  6 using namespace std;  7   8 typedef long long ll;  9  10 const int CANTO = 100010; 11 const int LEN = 6; 12  13 int fac[10]; 14 bool vis[CANTO]; 15 int begin, end; 16 struct Sit 17 { 18     int arr[LEN]; 19     int step; 20 }; 21  22 void makefac() 23 { 24     fac[0] = fac[1] = 1; 25     for(int i = 2; i <= 8; i++) 26         fac[i] = i * fac[i-1]; 27 } 28  29 int canto(int arr[]) 30 { 31     int res = 0; 32     for(int i = 0; i < LEN; i++){ 33         int num=0; 34         for(int j=i+1;j<LEN;j++) 35             if(arr[j]<arr[i]) num++; 36         res+=(num*fac[LEN-i-1]); 37     } 38     //    res += fac[i+2] * arr[i]; 39     return res; 40 } 41  42 int bfs(Sit src) 43 { 44     queue <Sit> q; 45     Sit now, tmp; 46     int t, c; 47     vis[begin] = true; 48     q.push(src); 49     while(!q.empty()) 50     { 51         now = q.front(); 52         q.pop(); 53         tmp = now, tmp.step++; t = tmp.arr[0]; 54         tmp.arr[0] = tmp.arr[3]; 55         tmp.arr[3] = tmp.arr[1]; 56         tmp.arr[1] = tmp.arr[2]; 57         tmp.arr[2] = t; 58         c = canto(tmp.arr); 59         if (c == end){ 60             return tmp.step; 61         } 62         if (!vis[c]){ 63             vis[c] = true; 64             q.push(tmp); 65         } 66         tmp = now, tmp.step++; t = tmp.arr[0]; 67         tmp.arr[0] = tmp.arr[2]; 68         tmp.arr[2] = tmp.arr[1]; 69         tmp.arr[1] = tmp.arr[3]; 70         tmp.arr[3] = t; 71         c = canto(tmp.arr); 72         if (c == end){ 73             return tmp.step; 74         } 75         if (!vis[c]){ 76             vis[c] = true; 77             q.push(tmp); 78         } 79  80         tmp = now, tmp.step++; t = tmp.arr[1]; 81         tmp.arr[1] = tmp.arr[4]; 82         tmp.arr[4] = tmp.arr[0]; 83         tmp.arr[0] = tmp.arr[5]; 84         tmp.arr[5] = t; 85         c = canto(tmp.arr); 86         if (c == end){ 87             return tmp.step; 88         } 89         if (!vis[c]){ 90             vis[c] = true; 91             q.push(tmp); 92         } 93  94         tmp = now, tmp.step++; t = tmp.arr[1]; 95         tmp.arr[1] = tmp.arr[5]; 96         tmp.arr[5] = tmp.arr[0]; 97         tmp.arr[0] = tmp.arr[4]; 98         tmp.arr[4] = t; 99         c = canto(tmp.arr);100         if (c == end){101             return tmp.step;102         }103         if (!vis[c]){104             vis[c] = true;105             q.push(tmp);106         }107     }108     return -1;109 }110 111 int main()112 {113     makefac();114     int src[LEN];115     int dst[LEN];116     while(~scanf("%d", src)){117         memset(vis, 0, sizeof(vis));118         for(int i = 1; i < LEN; i++)119             scanf("%d", src+i);120         for(int i = 0; i < LEN; i++)121             scanf("%d", dst+i);122         begin = canto(src);123         end = canto(dst);124         if (begin == end){125             printf("0\n");126             continue;127         }128         Sit x;129         memcpy(x.arr, src, LEN*sizeof(int));130         x.step = 0;131         printf("%d\n", bfs(x));132     }133     return 0;134 }

 

经过以下代码验证,网上的代码,康托展开是连续值,卜神的只是起到了展开作用,不过代码更加简洁。

 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <queue> 5 #include <algorithm> 6 using namespace std; 7  8 typedef long long ll; 9 10 const int CANTO = 100010;11 const int LEN = 6;12 13 int fac[10];14 int a[LEN];15 16 void makefac()17 {18     fac[0] = fac[1] = 1;19     for(int i = 2; i <= 8; i++)20         fac[i] = i * fac[i-1];21 }22 23 int canto(int arr[])24 {25     int res = 0;26     for(int i = 0; i < LEN; i++){27         int num=0;28         for(int j=i+1;j<LEN;j++)29             if(arr[j]<arr[i]) num++;30         res+=(num*fac[LEN-i-1]);31     }32     //    res += fac[i+2] * arr[i];33     return res;34 }35 36 int canto2(int arr[])37 {38     int res = 0;39     for(int i = 0; i < LEN; i++){40      //   int num=0;41      //   for(int j=i+1;j<LEN;j++)42        //     if(arr[j]<arr[i]) num++;43       //  res+=(num*fac[LEN-i-1]);44       res += fac[i+2] * arr[i];45     }46     //    res += fac[i+2] * arr[i];47     return res;48 }49 50 51 int main()52 {53     freopen("data.out","w",stdout);54     makefac();55     a[0]=1;a[1]=2;a[2]=3;a[3]=4;a[4]=5;a[5]=6;56     printf("a=%d %d %d %d %d %d ",a[0],a[1],a[2],a[3],a[4],a[5]);57     printf("can=%d %d\n",canto(a),canto2(a));58     while(next_permutation(a+0, a + LEN)  ){59             printf("a=%d %d %d %d %d %d ",a[0],a[1],a[2],a[3],a[4],a[5]);60         printf("can=%d %d\n",canto(a),canto2(a));61     }62     return 0;63 }

 

  1 a=1 2 3 4 5 6 can=0 34406  2 a=1 2 3 4 6 5 can=1 30086  3 a=1 2 3 5 4 6 can=2 33806  4 a=1 2 3 5 6 4 can=3 25166  5 a=1 2 3 6 4 5 can=4 28886  6 a=1 2 3 6 5 4 can=5 24566  7 a=1 2 4 3 5 6 can=6 34310  8 a=1 2 4 3 6 5 can=7 29990  9 a=1 2 4 5 3 6 can=8 33110 10 a=1 2 4 5 6 3 can=9 20150 11 a=1 2 4 6 3 5 can=10 28190 12 a=1 2 4 6 5 3 can=11 19550 13 a=1 2 5 3 4 6 can=12 33614 14 a=1 2 5 3 6 4 can=13 24974 15 a=1 2 5 4 3 6 can=14 33014 16 a=1 2 5 4 6 3 can=15 20054 17 a=1 2 5 6 3 4 can=16 23174 18 a=1 2 5 6 4 3 can=17 18854 19 a=1 2 6 3 4 5 can=18 28598 20 a=1 2 6 3 5 4 can=19 24278 21 a=1 2 6 4 3 5 can=20 27998 22 a=1 2 6 4 5 3 can=21 19358 23 a=1 2 6 5 3 4 can=22 23078 24 a=1 2 6 5 4 3 can=23 18758 25 a=1 3 2 4 5 6 can=24 34388 26 a=1 3 2 4 6 5 can=25 30068 27 a=1 3 2 5 4 6 can=26 33788 28 a=1 3 2 5 6 4 can=27 25148 29 a=1 3 2 6 4 5 can=28 28868 30 a=1 3 2 6 5 4 can=29 24548 31 a=1 3 4 2 5 6 can=30 34196 32 a=1 3 4 2 6 5 can=31 29876 33 a=1 3 4 5 2 6 can=32 32396 34 a=1 3 4 5 6 2 can=33 15116 35 a=1 3 4 6 2 5 can=34 27476 36 a=1 3 4 6 5 2 can=35 14516 37 a=1 3 5 2 4 6 can=36 33500 38 a=1 3 5 2 6 4 can=37 24860 39 a=1 3 5 4 2 6 can=38 32300 40 a=1 3 5 4 6 2 can=39 15020 41 a=1 3 5 6 2 4 can=40 22460 42 a=1 3 5 6 4 2 can=41 13820 43 a=1 3 6 2 4 5 can=42 28484 44 a=1 3 6 2 5 4 can=43 24164 45 a=1 3 6 4 2 5 can=44 27284 46 a=1 3 6 4 5 2 can=45 14324 47 a=1 3 6 5 2 4 can=46 22364 48 a=1 3 6 5 4 2 can=47 13724 49 a=1 4 2 3 5 6 can=48 34274 50 a=1 4 2 3 6 5 can=49 29954 51 a=1 4 2 5 3 6 can=50 33074 52 a=1 4 2 5 6 3 can=51 20114 53 a=1 4 2 6 3 5 can=52 28154 54 a=1 4 2 6 5 3 can=53 19514 55 a=1 4 3 2 5 6 can=54 34178 56 a=1 4 3 2 6 5 can=55 29858 57 a=1 4 3 5 2 6 can=56 32378 58 a=1 4 3 5 6 2 can=57 15098 59 a=1 4 3 6 2 5 can=58 27458 60 a=1 4 3 6 5 2 can=59 14498 61 a=1 4 5 2 3 6 can=60 32786 62 a=1 4 5 2 6 3 can=61 19826 63 a=1 4 5 3 2 6 can=62 32186 64 a=1 4 5 3 6 2 can=63 14906 65 a=1 4 5 6 2 3 can=64 17426 66 a=1 4 5 6 3 2 can=65 13106 67 a=1 4 6 2 3 5 can=66 27770 68 a=1 4 6 2 5 3 can=67 19130 69 a=1 4 6 3 2 5 can=68 27170 70 a=1 4 6 3 5 2 can=69 14210 71 a=1 4 6 5 2 3 can=70 17330 72 a=1 4 6 5 3 2 can=71 13010 73 a=1 5 2 3 4 6 can=72 33560 74 a=1 5 2 3 6 4 can=73 24920 75 a=1 5 2 4 3 6 can=74 32960 76 a=1 5 2 4 6 3 can=75 20000 77 a=1 5 2 6 3 4 can=76 23120 78 a=1 5 2 6 4 3 can=77 18800 79 a=1 5 3 2 4 6 can=78 33464 80 a=1 5 3 2 6 4 can=79 24824 81 a=1 5 3 4 2 6 can=80 32264 82 a=1 5 3 4 6 2 can=81 14984 83 a=1 5 3 6 2 4 can=82 22424 84 a=1 5 3 6 4 2 can=83 13784 85 a=1 5 4 2 3 6 can=84 32768 86 a=1 5 4 2 6 3 can=85 19808 87 a=1 5 4 3 2 6 can=86 32168 88 a=1 5 4 3 6 2 can=87 14888 89 a=1 5 4 6 2 3 can=88 17408 90 a=1 5 4 6 3 2 can=89 13088 91 a=1 5 6 2 3 4 can=90 22736 92 a=1 5 6 2 4 3 can=91 18416 93 a=1 5 6 3 2 4 can=92 22136 94 a=1 5 6 3 4 2 can=93 13496 95 a=1 5 6 4 2 3 can=94 17216 96 a=1 5 6 4 3 2 can=95 12896 97 a=1 6 2 3 4 5 can=96 28526 98 a=1 6 2 3 5 4 can=97 24206 99 a=1 6 2 4 3 5 can=98 27926100 a=1 6 2 4 5 3 can=99 19286101 a=1 6 2 5 3 4 can=100 23006102 a=1 6 2 5 4 3 can=101 18686103 a=1 6 3 2 4 5 can=102 28430104 a=1 6 3 2 5 4 can=103 24110105 a=1 6 3 4 2 5 can=104 27230106 a=1 6 3 4 5 2 can=105 14270107 a=1 6 3 5 2 4 can=106 22310108 a=1 6 3 5 4 2 can=107 13670109 a=1 6 4 2 3 5 can=108 27734110 a=1 6 4 2 5 3 can=109 19094111 a=1 6 4 3 2 5 can=110 27134112 a=1 6 4 3 5 2 can=111 14174113 a=1 6 4 5 2 3 can=112 17294114 a=1 6 4 5 3 2 can=113 12974115 a=1 6 5 2 3 4 can=114 22718116 a=1 6 5 2 4 3 can=115 18398117 a=1 6 5 3 2 4 can=116 22118118 a=1 6 5 3 4 2 can=117 13478119 a=1 6 5 4 2 3 can=118 17198120 a=1 6 5 4 3 2 can=119 12878121 a=2 1 3 4 5 6 can=120 34402122 a=2 1 3 4 6 5 can=121 30082123 a=2 1 3 5 4 6 can=122 33802124 a=2 1 3 5 6 4 can=123 25162125 a=2 1 3 6 4 5 can=124 28882126 a=2 1 3 6 5 4 can=125 24562127 a=2 1 4 3 5 6 can=126 34306128 a=2 1 4 3 6 5 can=127 29986129 a=2 1 4 5 3 6 can=128 33106130 a=2 1 4 5 6 3 can=129 20146131 a=2 1 4 6 3 5 can=130 28186132 a=2 1 4 6 5 3 can=131 19546133 a=2 1 5 3 4 6 can=132 33610134 a=2 1 5 3 6 4 can=133 24970135 a=2 1 5 4 3 6 can=134 33010136 a=2 1 5 4 6 3 can=135 20050137 a=2 1 5 6 3 4 can=136 23170138 a=2 1 5 6 4 3 can=137 18850139 a=2 1 6 3 4 5 can=138 28594140 a=2 1 6 3 5 4 can=139 24274141 a=2 1 6 4 3 5 can=140 27994142 a=2 1 6 4 5 3 can=141 19354143 a=2 1 6 5 3 4 can=142 23074144 a=2 1 6 5 4 3 can=143 18754145 a=2 3 1 4 5 6 can=144 34366146 a=2 3 1 4 6 5 can=145 30046147 a=2 3 1 5 4 6 can=146 33766148 a=2 3 1 5 6 4 can=147 25126149 a=2 3 1 6 4 5 can=148 28846150 a=2 3 1 6 5 4 can=149 24526151 a=2 3 4 1 5 6 can=150 34078152 a=2 3 4 1 6 5 can=151 29758153 a=2 3 4 5 1 6 can=152 31678154 a=2 3 4 5 6 1 can=153 10078155 a=2 3 4 6 1 5 can=154 26758156 a=2 3 4 6 5 1 can=155 9478157 a=2 3 5 1 4 6 can=156 33382158 a=2 3 5 1 6 4 can=157 24742159 a=2 3 5 4 1 6 can=158 31582160 a=2 3 5 4 6 1 can=159 9982161 a=2 3 5 6 1 4 can=160 21742162 a=2 3 5 6 4 1 can=161 8782163 a=2 3 6 1 4 5 can=162 28366164 a=2 3 6 1 5 4 can=163 24046165 a=2 3 6 4 1 5 can=164 26566166 a=2 3 6 4 5 1 can=165 9286167 a=2 3 6 5 1 4 can=166 21646168 a=2 3 6 5 4 1 can=167 8686169 a=2 4 1 3 5 6 can=168 34252170 a=2 4 1 3 6 5 can=169 29932171 a=2 4 1 5 3 6 can=170 33052172 a=2 4 1 5 6 3 can=171 20092173 a=2 4 1 6 3 5 can=172 28132174 a=2 4 1 6 5 3 can=173 19492175 a=2 4 3 1 5 6 can=174 34060176 a=2 4 3 1 6 5 can=175 29740177 a=2 4 3 5 1 6 can=176 31660178 a=2 4 3 5 6 1 can=177 10060179 a=2 4 3 6 1 5 can=178 26740180 a=2 4 3 6 5 1 can=179 9460181 a=2 4 5 1 3 6 can=180 32668182 a=2 4 5 1 6 3 can=181 19708183 a=2 4 5 3 1 6 can=182 31468184 a=2 4 5 3 6 1 can=183 9868185 a=2 4 5 6 1 3 can=184 16708186 a=2 4 5 6 3 1 can=185 8068187 a=2 4 6 1 3 5 can=186 27652188 a=2 4 6 1 5 3 can=187 19012189 a=2 4 6 3 1 5 can=188 26452190 a=2 4 6 3 5 1 can=189 9172191 a=2 4 6 5 1 3 can=190 16612192 a=2 4 6 5 3 1 can=191 7972193 a=2 5 1 3 4 6 can=192 33538194 a=2 5 1 3 6 4 can=193 24898195 a=2 5 1 4 3 6 can=194 32938196 a=2 5 1 4 6 3 can=195 19978197 a=2 5 1 6 3 4 can=196 23098198 a=2 5 1 6 4 3 can=197 18778199 a=2 5 3 1 4 6 can=198 33346200 a=2 5 3 1 6 4 can=199 24706201 a=2 5 3 4 1 6 can=200 31546202 a=2 5 3 4 6 1 can=201 9946203 a=2 5 3 6 1 4 can=202 21706204 a=2 5 3 6 4 1 can=203 8746205 a=2 5 4 1 3 6 can=204 32650206 a=2 5 4 1 6 3 can=205 19690207 a=2 5 4 3 1 6 can=206 31450208 a=2 5 4 3 6 1 can=207 9850209 a=2 5 4 6 1 3 can=208 16690210 a=2 5 4 6 3 1 can=209 8050211 a=2 5 6 1 3 4 can=210 22618212 a=2 5 6 1 4 3 can=211 18298213 a=2 5 6 3 1 4 can=212 21418214 a=2 5 6 3 4 1 can=213 8458215 a=2 5 6 4 1 3 can=214 16498216 a=2 5 6 4 3 1 can=215 7858217 a=2 6 1 3 4 5 can=216 28504218 a=2 6 1 3 5 4 can=217 24184219 a=2 6 1 4 3 5 can=218 27904220 a=2 6 1 4 5 3 can=219 19264221 a=2 6 1 5 3 4 can=220 22984222 a=2 6 1 5 4 3 can=221 18664223 a=2 6 3 1 4 5 can=222 28312224 a=2 6 3 1 5 4 can=223 23992225 a=2 6 3 4 1 5 can=224 26512226 a=2 6 3 4 5 1 can=225 9232227 a=2 6 3 5 1 4 can=226 21592228 a=2 6 3 5 4 1 can=227 8632229 a=2 6 4 1 3 5 can=228 27616230 a=2 6 4 1 5 3 can=229 18976231 a=2 6 4 3 1 5 can=230 26416232 a=2 6 4 3 5 1 can=231 9136233 a=2 6 4 5 1 3 can=232 16576234 a=2 6 4 5 3 1 can=233 7936235 a=2 6 5 1 3 4 can=234 22600236 a=2 6 5 1 4 3 can=235 18280237 a=2 6 5 3 1 4 can=236 21400238 a=2 6 5 3 4 1 can=237 8440239 a=2 6 5 4 1 3 can=238 16480240 a=2 6 5 4 3 1 can=239 7840241 a=3 1 2 4 5 6 can=240 34380242 a=3 1 2 4 6 5 can=241 30060243 a=3 1 2 5 4 6 can=242 33780244 a=3 1 2 5 6 4 can=243 25140245 a=3 1 2 6 4 5 can=244 28860246 a=3 1 2 6 5 4 can=245 24540247 a=3 1 4 2 5 6 can=246 34188248 a=3 1 4 2 6 5 can=247 29868249 a=3 1 4 5 2 6 can=248 32388250 a=3 1 4 5 6 2 can=249 15108251 a=3 1 4 6 2 5 can=250 27468252 a=3 1 4 6 5 2 can=251 14508253 a=3 1 5 2 4 6 can=252 33492254 a=3 1 5 2 6 4 can=253 24852255 a=3 1 5 4 2 6 can=254 32292256 a=3 1 5 4 6 2 can=255 15012257 a=3 1 5 6 2 4 can=256 22452258 a=3 1 5 6 4 2 can=257 13812259 a=3 1 6 2 4 5 can=258 28476260 a=3 1 6 2 5 4 can=259 24156261 a=3 1 6 4 2 5 can=260 27276262 a=3 1 6 4 5 2 can=261 14316263 a=3 1 6 5 2 4 can=262 22356264 a=3 1 6 5 4 2 can=263 13716265 a=3 2 1 4 5 6 can=264 34362266 a=3 2 1 4 6 5 can=265 30042267 a=3 2 1 5 4 6 can=266 33762268 a=3 2 1 5 6 4 can=267 25122269 a=3 2 1 6 4 5 can=268 28842270 a=3 2 1 6 5 4 can=269 24522271 a=3 2 4 1 5 6 can=270 34074272 a=3 2 4 1 6 5 can=271 29754273 a=3 2 4 5 1 6 can=272 31674274 a=3 2 4 5 6 1 can=273 10074275 a=3 2 4 6 1 5 can=274 26754276 a=3 2 4 6 5 1 can=275 9474277 a=3 2 5 1 4 6 can=276 33378278 a=3 2 5 1 6 4 can=277 24738279 a=3 2 5 4 1 6 can=278 31578280 a=3 2 5 4 6 1 can=279 9978281 a=3 2 5 6 1 4 can=280 21738282 a=3 2 5 6 4 1 can=281 8778283 a=3 2 6 1 4 5 can=282 28362284 a=3 2 6 1 5 4 can=283 24042285 a=3 2 6 4 1 5 can=284 26562286 a=3 2 6 4 5 1 can=285 9282287 a=3 2 6 5 1 4 can=286 21642288 a=3 2 6 5 4 1 can=287 8682289 a=3 4 1 2 5 6 can=288 34134290 a=3 4 1 2 6 5 can=289 29814291 a=3 4 1 5 2 6 can=290 32334292 a=3 4 1 5 6 2 can=291 15054293 a=3 4 1 6 2 5 can=292 27414294 a=3 4 1 6 5 2 can=293 14454295 a=3 4 2 1 5 6 can=294 34038296 a=3 4 2 1 6 5 can=295 29718297 a=3 4 2 5 1 6 can=296 31638298 a=3 4 2 5 6 1 can=297 10038299 a=3 4 2 6 1 5 can=298 26718300 a=3 4 2 6 5 1 can=299 9438301 a=3 4 5 1 2 6 can=300 31950302 a=3 4 5 1 6 2 can=301 14670303 a=3 4 5 2 1 6 can=302 31350304 a=3 4 5 2 6 1 can=303 9750305 a=3 4 5 6 1 2 can=304 11670306 a=3 4 5 6 2 1 can=305 7350307 a=3 4 6 1 2 5 can=306 26934308 a=3 4 6 1 5 2 can=307 13974309 a=3 4 6 2 1 5 can=308 26334310 a=3 4 6 2 5 1 can=309 9054311 a=3 4 6 5 1 2 can=310 11574312 a=3 4 6 5 2 1 can=311 7254313 a=3 5 1 2 4 6 can=312 33420314 a=3 5 1 2 6 4 can=313 24780315 a=3 5 1 4 2 6 can=314 32220316 a=3 5 1 4 6 2 can=315 14940317 a=3 5 1 6 2 4 can=316 22380318 a=3 5 1 6 4 2 can=317 13740319 a=3 5 2 1 4 6 can=318 33324320 a=3 5 2 1 6 4 can=319 24684321 a=3 5 2 4 1 6 can=320 31524322 a=3 5 2 4 6 1 can=321 9924323 a=3 5 2 6 1 4 can=322 21684324 a=3 5 2 6 4 1 can=323 8724325 a=3 5 4 1 2 6 can=324 31932326 a=3 5 4 1 6 2 can=325 14652327 a=3 5 4 2 1 6 can=326 31332328 a=3 5 4 2 6 1 can=327 9732329 a=3 5 4 6 1 2 can=328 11652330 a=3 5 4 6 2 1 can=329 7332331 a=3 5 6 1 2 4 can=330 21900332 a=3 5 6 1 4 2 can=331 13260333 a=3 5 6 2 1 4 can=332 21300334 a=3 5 6 2 4 1 can=333 8340335 a=3 5 6 4 1 2 can=334 11460336 a=3 5 6 4 2 1 can=335 7140337 a=3 6 1 2 4 5 can=336 28386338 a=3 6 1 2 5 4 can=337 24066339 a=3 6 1 4 2 5 can=338 27186340 a=3 6 1 4 5 2 can=339 14226341 a=3 6 1 5 2 4 can=340 22266342 a=3 6 1 5 4 2 can=341 13626343 a=3 6 2 1 4 5 can=342 28290344 a=3 6 2 1 5 4 can=343 23970345 a=3 6 2 4 1 5 can=344 26490346 a=3 6 2 4 5 1 can=345 9210347 a=3 6 2 5 1 4 can=346 21570348 a=3 6 2 5 4 1 can=347 8610349 a=3 6 4 1 2 5 can=348 26898350 a=3 6 4 1 5 2 can=349 13938351 a=3 6 4 2 1 5 can=350 26298352 a=3 6 4 2 5 1 can=351 9018353 a=3 6 4 5 1 2 can=352 11538354 a=3 6 4 5 2 1 can=353 7218355 a=3 6 5 1 2 4 can=354 21882356 a=3 6 5 1 4 2 can=355 13242357 a=3 6 5 2 1 4 can=356 21282358 a=3 6 5 2 4 1 can=357 8322359 a=3 6 5 4 1 2 can=358 11442360 a=3 6 5 4 2 1 can=359 7122361 a=4 1 2 3 5 6 can=360 34262362 a=4 1 2 3 6 5 can=361 29942363 a=4 1 2 5 3 6 can=362 33062364 a=4 1 2 5 6 3 can=363 20102365 a=4 1 2 6 3 5 can=364 28142366 a=4 1 2 6 5 3 can=365 19502367 a=4 1 3 2 5 6 can=366 34166368 a=4 1 3 2 6 5 can=367 29846369 a=4 1 3 5 2 6 can=368 32366370 a=4 1 3 5 6 2 can=369 15086371 a=4 1 3 6 2 5 can=370 27446372 a=4 1 3 6 5 2 can=371 14486373 a=4 1 5 2 3 6 can=372 32774374 a=4 1 5 2 6 3 can=373 19814375 a=4 1 5 3 2 6 can=374 32174376 a=4 1 5 3 6 2 can=375 14894377 a=4 1 5 6 2 3 can=376 17414378 a=4 1 5 6 3 2 can=377 13094379 a=4 1 6 2 3 5 can=378 27758380 a=4 1 6 2 5 3 can=379 19118381 a=4 1 6 3 2 5 can=380 27158382 a=4 1 6 3 5 2 can=381 14198383 a=4 1 6 5 2 3 can=382 17318384 a=4 1 6 5 3 2 can=383 12998385 a=4 2 1 3 5 6 can=384 34244386 a=4 2 1 3 6 5 can=385 29924387 a=4 2 1 5 3 6 can=386 33044388 a=4 2 1 5 6 3 can=387 20084389 a=4 2 1 6 3 5 can=388 28124390 a=4 2 1 6 5 3 can=389 19484391 a=4 2 3 1 5 6 can=390 34052392 a=4 2 3 1 6 5 can=391 29732393 a=4 2 3 5 1 6 can=392 31652394 a=4 2 3 5 6 1 can=393 10052395 a=4 2 3 6 1 5 can=394 26732396 a=4 2 3 6 5 1 can=395 9452397 a=4 2 5 1 3 6 can=396 32660398 a=4 2 5 1 6 3 can=397 19700399 a=4 2 5 3 1 6 can=398 31460400 a=4 2 5 3 6 1 can=399 9860401 a=4 2 5 6 1 3 can=400 16700402 a=4 2 5 6 3 1 can=401 8060403 a=4 2 6 1 3 5 can=402 27644404 a=4 2 6 1 5 3 can=403 19004405 a=4 2 6 3 1 5 can=404 26444406 a=4 2 6 3 5 1 can=405 9164407 a=4 2 6 5 1 3 can=406 16604408 a=4 2 6 5 3 1 can=407 7964409 a=4 3 1 2 5 6 can=408 34130410 a=4 3 1 2 6 5 can=409 29810411 a=4 3 1 5 2 6 can=410 32330412 a=4 3 1 5 6 2 can=411 15050413 a=4 3 1 6 2 5 can=412 27410414 a=4 3 1 6 5 2 can=413 14450415 a=4 3 2 1 5 6 can=414 34034416 a=4 3 2 1 6 5 can=415 29714417 a=4 3 2 5 1 6 can=416 31634418 a=4 3 2 5 6 1 can=417 10034419 a=4 3 2 6 1 5 can=418 26714420 a=4 3 2 6 5 1 can=419 9434421 a=4 3 5 1 2 6 can=420 31946422 a=4 3 5 1 6 2 can=421 14666423 a=4 3 5 2 1 6 can=422 31346424 a=4 3 5 2 6 1 can=423 9746425 a=4 3 5 6 1 2 can=424 11666426 a=4 3 5 6 2 1 can=425 7346427 a=4 3 6 1 2 5 can=426 26930428 a=4 3 6 1 5 2 can=427 13970429 a=4 3 6 2 1 5 can=428 26330430 a=4 3 6 2 5 1 can=429 9050431 a=4 3 6 5 1 2 can=430 11570432 a=4 3 6 5 2 1 can=431 7250433 a=4 5 1 2 3 6 can=432 32702434 a=4 5 1 2 6 3 can=433 19742435 a=4 5 1 3 2 6 can=434 32102436 a=4 5 1 3 6 2 can=435 14822437 a=4 5 1 6 2 3 can=436 17342438 a=4 5 1 6 3 2 can=437 13022439 a=4 5 2 1 3 6 can=438 32606440 a=4 5 2 1 6 3 can=439 19646441 a=4 5 2 3 1 6 can=440 31406442 a=4 5 2 3 6 1 can=441 9806443 a=4 5 2 6 1 3 can=442 16646444 a=4 5 2 6 3 1 can=443 8006445 a=4 5 3 1 2 6 can=444 31910446 a=4 5 3 1 6 2 can=445 14630447 a=4 5 3 2 1 6 can=446 31310448 a=4 5 3 2 6 1 can=447 9710449 a=4 5 3 6 1 2 can=448 11630450 a=4 5 3 6 2 1 can=449 7310451 a=4 5 6 1 2 3 can=450 16862452 a=4 5 6 1 3 2 can=451 12542453 a=4 5 6 2 1 3 can=452 16262454 a=4 5 6 2 3 1 can=453 7622455 a=4 5 6 3 1 2 can=454 11342456 a=4 5 6 3 2 1 can=455 7022457 a=4 6 1 2 3 5 can=456 27668458 a=4 6 1 2 5 3 can=457 19028459 a=4 6 1 3 2 5 can=458 27068460 a=4 6 1 3 5 2 can=459 14108461 a=4 6 1 5 2 3 can=460 17228462 a=4 6 1 5 3 2 can=461 12908463 a=4 6 2 1 3 5 can=462 27572464 a=4 6 2 1 5 3 can=463 18932465 a=4 6 2 3 1 5 can=464 26372466 a=4 6 2 3 5 1 can=465 9092467 a=4 6 2 5 1 3 can=466 16532468 a=4 6 2 5 3 1 can=467 7892469 a=4 6 3 1 2 5 can=468 26876470 a=4 6 3 1 5 2 can=469 13916471 a=4 6 3 2 1 5 can=470 26276472 a=4 6 3 2 5 1 can=471 8996473 a=4 6 3 5 1 2 can=472 11516474 a=4 6 3 5 2 1 can=473 7196475 a=4 6 5 1 2 3 can=474 16844476 a=4 6 5 1 3 2 can=475 12524477 a=4 6 5 2 1 3 can=476 16244478 a=4 6 5 2 3 1 can=477 7604479 a=4 6 5 3 1 2 can=478 11324480 a=4 6 5 3 2 1 can=479 7004481 a=5 1 2 3 4 6 can=480 33544482 a=5 1 2 3 6 4 can=481 24904483 a=5 1 2 4 3 6 can=482 32944484 a=5 1 2 4 6 3 can=483 19984485 a=5 1 2 6 3 4 can=484 23104486 a=5 1 2 6 4 3 can=485 18784487 a=5 1 3 2 4 6 can=486 33448488 a=5 1 3 2 6 4 can=487 24808489 a=5 1 3 4 2 6 can=488 32248490 a=5 1 3 4 6 2 can=489 14968491 a=5 1 3 6 2 4 can=490 22408492 a=5 1 3 6 4 2 can=491 13768493 a=5 1 4 2 3 6 can=492 32752494 a=5 1 4 2 6 3 can=493 19792495 a=5 1 4 3 2 6 can=494 32152496 a=5 1 4 3 6 2 can=495 14872497 a=5 1 4 6 2 3 can=496 17392498 a=5 1 4 6 3 2 can=497 13072499 a=5 1 6 2 3 4 can=498 22720500 a=5 1 6 2 4 3 can=499 18400501 a=5 1 6 3 2 4 can=500 22120502 a=5 1 6 3 4 2 can=501 13480503 a=5 1 6 4 2 3 can=502 17200504 a=5 1 6 4 3 2 can=503 12880505 a=5 2 1 3 4 6 can=504 33526506 a=5 2 1 3 6 4 can=505 24886507 a=5 2 1 4 3 6 can=506 32926508 a=5 2 1 4 6 3 can=507 19966509 a=5 2 1 6 3 4 can=508 23086510 a=5 2 1 6 4 3 can=509 18766511 a=5 2 3 1 4 6 can=510 33334512 a=5 2 3 1 6 4 can=511 24694513 a=5 2 3 4 1 6 can=512 31534514 a=5 2 3 4 6 1 can=513 9934515 a=5 2 3 6 1 4 can=514 21694516 a=5 2 3 6 4 1 can=515 8734517 a=5 2 4 1 3 6 can=516 32638518 a=5 2 4 1 6 3 can=517 19678519 a=5 2 4 3 1 6 can=518 31438520 a=5 2 4 3 6 1 can=519 9838521 a=5 2 4 6 1 3 can=520 16678522 a=5 2 4 6 3 1 can=521 8038523 a=5 2 6 1 3 4 can=522 22606524 a=5 2 6 1 4 3 can=523 18286525 a=5 2 6 3 1 4 can=524 21406526 a=5 2 6 3 4 1 can=525 8446527 a=5 2 6 4 1 3 can=526 16486528 a=5 2 6 4 3 1 can=527 7846529 a=5 3 1 2 4 6 can=528 33412530 a=5 3 1 2 6 4 can=529 24772531 a=5 3 1 4 2 6 can=530 32212532 a=5 3 1 4 6 2 can=531 14932533 a=5 3 1 6 2 4 can=532 22372534 a=5 3 1 6 4 2 can=533 13732535 a=5 3 2 1 4 6 can=534 33316536 a=5 3 2 1 6 4 can=535 24676537 a=5 3 2 4 1 6 can=536 31516538 a=5 3 2 4 6 1 can=537 9916539 a=5 3 2 6 1 4 can=538 21676540 a=5 3 2 6 4 1 can=539 8716541 a=5 3 4 1 2 6 can=540 31924542 a=5 3 4 1 6 2 can=541 14644543 a=5 3 4 2 1 6 can=542 31324544 a=5 3 4 2 6 1 can=543 9724545 a=5 3 4 6 1 2 can=544 11644546 a=5 3 4 6 2 1 can=545 7324547 a=5 3 6 1 2 4 can=546 21892548 a=5 3 6 1 4 2 can=547 13252549 a=5 3 6 2 1 4 can=548 21292550 a=5 3 6 2 4 1 can=549 8332551 a=5 3 6 4 1 2 can=550 11452552 a=5 3 6 4 2 1 can=551 7132553 a=5 4 1 2 3 6 can=552 32698554 a=5 4 1 2 6 3 can=553 19738555 a=5 4 1 3 2 6 can=554 32098556 a=5 4 1 3 6 2 can=555 14818557 a=5 4 1 6 2 3 can=556 17338558 a=5 4 1 6 3 2 can=557 13018559 a=5 4 2 1 3 6 can=558 32602560 a=5 4 2 1 6 3 can=559 19642561 a=5 4 2 3 1 6 can=560 31402562 a=5 4 2 3 6 1 can=561 9802563 a=5 4 2 6 1 3 can=562 16642564 a=5 4 2 6 3 1 can=563 8002565 a=5 4 3 1 2 6 can=564 31906566 a=5 4 3 1 6 2 can=565 14626567 a=5 4 3 2 1 6 can=566 31306568 a=5 4 3 2 6 1 can=567 9706569 a=5 4 3 6 1 2 can=568 11626570 a=5 4 3 6 2 1 can=569 7306571 a=5 4 6 1 2 3 can=570 16858572 a=5 4 6 1 3 2 can=571 12538573 a=5 4 6 2 1 3 can=572 16258574 a=5 4 6 2 3 1 can=573 7618575 a=5 4 6 3 1 2 can=574 11338576 a=5 4 6 3 2 1 can=575 7018577 a=5 6 1 2 3 4 can=576 22630578 a=5 6 1 2 4 3 can=577 18310579 a=5 6 1 3 2 4 can=578 22030580 a=5 6 1 3 4 2 can=579 13390581 a=5 6 1 4 2 3 can=580 17110582 a=5 6 1 4 3 2 can=581 12790583 a=5 6 2 1 3 4 can=582 22534584 a=5 6 2 1 4 3 can=583 18214585 a=5 6 2 3 1 4 can=584 21334586 a=5 6 2 3 4 1 can=585 8374587 a=5 6 2 4 1 3 can=586 16414588 a=5 6 2 4 3 1 can=587 7774589 a=5 6 3 1 2 4 can=588 21838590 a=5 6 3 1 4 2 can=589 13198591 a=5 6 3 2 1 4 can=590 21238592 a=5 6 3 2 4 1 can=591 8278593 a=5 6 3 4 1 2 can=592 11398594 a=5 6 3 4 2 1 can=593 7078595 a=5 6 4 1 2 3 can=594 16822596 a=5 6 4 1 3 2 can=595 12502597 a=5 6 4 2 1 3 can=596 16222598 a=5 6 4 2 3 1 can=597 7582599 a=5 6 4 3 1 2 can=598 11302600 a=5 6 4 3 2 1 can=599 6982601 a=6 1 2 3 4 5 can=600 28506602 a=6 1 2 3 5 4 can=601 24186603 a=6 1 2 4 3 5 can=602 27906604 a=6 1 2 4 5 3 can=603 19266605 a=6 1 2 5 3 4 can=604 22986606 a=6 1 2 5 4 3 can=605 18666607 a=6 1 3 2 4 5 can=606 28410608 a=6 1 3 2 5 4 can=607 24090609 a=6 1 3 4 2 5 can=608 27210610 a=6 1 3 4 5 2 can=609 14250611 a=6 1 3 5 2 4 can=610 22290612 a=6 1 3 5 4 2 can=611 13650613 a=6 1 4 2 3 5 can=612 27714614 a=6 1 4 2 5 3 can=613 19074615 a=6 1 4 3 2 5 can=614 27114616 a=6 1 4 3 5 2 can=615 14154617 a=6 1 4 5 2 3 can=616 17274618 a=6 1 4 5 3 2 can=617 12954619 a=6 1 5 2 3 4 can=618 22698620 a=6 1 5 2 4 3 can=619 18378621 a=6 1 5 3 2 4 can=620 22098622 a=6 1 5 3 4 2 can=621 13458623 a=6 1 5 4 2 3 can=622 17178624 a=6 1 5 4 3 2 can=623 12858625 a=6 2 1 3 4 5 can=624 28488626 a=6 2 1 3 5 4 can=625 24168627 a=6 2 1 4 3 5 can=626 27888628 a=6 2 1 4 5 3 can=627 19248629 a=6 2 1 5 3 4 can=628 22968630 a=6 2 1 5 4 3 can=629 18648631 a=6 2 3 1 4 5 can=630 28296632 a=6 2 3 1 5 4 can=631 23976633 a=6 2 3 4 1 5 can=632 26496634 a=6 2 3 4 5 1 can=633 9216635 a=6 2 3 5 1 4 can=634 21576636 a=6 2 3 5 4 1 can=635 8616637 a=6 2 4 1 3 5 can=636 27600638 a=6 2 4 1 5 3 can=637 18960639 a=6 2 4 3 1 5 can=638 26400640 a=6 2 4 3 5 1 can=639 9120641 a=6 2 4 5 1 3 can=640 16560642 a=6 2 4 5 3 1 can=641 7920643 a=6 2 5 1 3 4 can=642 22584644 a=6 2 5 1 4 3 can=643 18264645 a=6 2 5 3 1 4 can=644 21384646 a=6 2 5 3 4 1 can=645 8424647 a=6 2 5 4 1 3 can=646 16464648 a=6 2 5 4 3 1 can=647 7824649 a=6 3 1 2 4 5 can=648 28374650 a=6 3 1 2 5 4 can=649 24054651 a=6 3 1 4 2 5 can=650 27174652 a=6 3 1 4 5 2 can=651 14214653 a=6 3 1 5 2 4 can=652 22254654 a=6 3 1 5 4 2 can=653 13614655 a=6 3 2 1 4 5 can=654 28278656 a=6 3 2 1 5 4 can=655 23958657 a=6 3 2 4 1 5 can=656 26478658 a=6 3 2 4 5 1 can=657 9198659 a=6 3 2 5 1 4 can=658 21558660 a=6 3 2 5 4 1 can=659 8598661 a=6 3 4 1 2 5 can=660 26886662 a=6 3 4 1 5 2 can=661 13926663 a=6 3 4 2 1 5 can=662 26286664 a=6 3 4 2 5 1 can=663 9006665 a=6 3 4 5 1 2 can=664 11526666 a=6 3 4 5 2 1 can=665 7206667 a=6 3 5 1 2 4 can=666 21870668 a=6 3 5 1 4 2 can=667 13230669 a=6 3 5 2 1 4 can=668 21270670 a=6 3 5 2 4 1 can=669 8310671 a=6 3 5 4 1 2 can=670 11430672 a=6 3 5 4 2 1 can=671 7110673 a=6 4 1 2 3 5 can=672 27660674 a=6 4 1 2 5 3 can=673 19020675 a=6 4 1 3 2 5 can=674 27060676 a=6 4 1 3 5 2 can=675 14100677 a=6 4 1 5 2 3 can=676 17220678 a=6 4 1 5 3 2 can=677 12900679 a=6 4 2 1 3 5 can=678 27564680 a=6 4 2 1 5 3 can=679 18924681 a=6 4 2 3 1 5 can=680 26364682 a=6 4 2 3 5 1 can=681 9084683 a=6 4 2 5 1 3 can=682 16524684 a=6 4 2 5 3 1 can=683 7884685 a=6 4 3 1 2 5 can=684 26868686 a=6 4 3 1 5 2 can=685 13908687 a=6 4 3 2 1 5 can=686 26268688 a=6 4 3 2 5 1 can=687 8988689 a=6 4 3 5 1 2 can=688 11508690 a=6 4 3 5 2 1 can=689 7188691 a=6 4 5 1 2 3 can=690 16836692 a=6 4 5 1 3 2 can=691 12516693 a=6 4 5 2 1 3 can=692 16236694 a=6 4 5 2 3 1 can=693 7596695 a=6 4 5 3 1 2 can=694 11316696 a=6 4 5 3 2 1 can=695 6996697 a=6 5 1 2 3 4 can=696 22626698 a=6 5 1 2 4 3 can=697 18306699 a=6 5 1 3 2 4 can=698 22026700 a=6 5 1 3 4 2 can=699 13386701 a=6 5 1 4 2 3 can=700 17106702 a=6 5 1 4 3 2 can=701 12786703 a=6 5 2 1 3 4 can=702 22530704 a=6 5 2 1 4 3 can=703 18210705 a=6 5 2 3 1 4 can=704 21330706 a=6 5 2 3 4 1 can=705 8370707 a=6 5 2 4 1 3 can=706 16410708 a=6 5 2 4 3 1 can=707 7770709 a=6 5 3 1 2 4 can=708 21834710 a=6 5 3 1 4 2 can=709 13194711 a=6 5 3 2 1 4 can=710 21234712 a=6 5 3 2 4 1 can=711 8274713 a=6 5 3 4 1 2 can=712 11394714 a=6 5 3 4 2 1 can=713 7074715 a=6 5 4 1 2 3 can=714 16818716 a=6 5 4 1 3 2 can=715 12498717 a=6 5 4 2 1 3 can=716 16218718 a=6 5 4 2 3 1 can=717 7578719 a=6 5 4 3 1 2 can=718 11298720 a=6 5 4 3 2 1 can=719 6978
View Code

 

hdu 5012 bfs 康托展开