http://acm.hdu.edu.cn/showproblem.php?pid=1043 http://poj.org/problem?id=1077 Eight Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9173 Accepted Submission(s): 2473 Special Judge Problem D…
不多述,直接上代码,至于康拓展开,以前的文章里有 #include<iostream> #include<cstdio> #include<queue> using namespace std; int fac[]={1,1,2,6,24,120,720,5040,40320,362880};//阶乘表 int dir[4][2]={1,0,0,1,-1,0,0,-1};//方向 int vis[362881]; int kangst,kanged; int t1[3]…
The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, each with a number from 1 to 15 on it, and all packed into a 4 by 4 frame with one tile missing. Let's…
http://acm.hdu.edu.cn/showproblem.php?pid=3567 Eight II Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 130000/65536 K (Java/Others)Total Submission(s): 4541 Accepted Submission(s): 990 Problem Description Eight-puzzle, which is also calle…
http://acm.hdu.edu.cn/showproblem.php?pid=1043 Eight Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 30907 Accepted Submission(s): 8122Special Judge Problem Description The 15-puzzle has bee…
思路:很裸的康拓展开.. 我的平衡树居然跑的比树状数组+二分还慢.. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int, int> #define y1 skldjfskldjg #define y2 skldfjsklejg using namespace std; ; ; const i…
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=4531 吉哥系列故事——乾坤大挪移 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 555 Accepted Submission(s): 178 Problem Description 只有进入本次马拉松复赛,你才有机会知道一个秘密:吉哥…
魔板 Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4050 Accepted Submission(s): 951 Problem Description 在魔方风靡全球之后不久,Rubik先生发明了它的简化版--魔板.魔板由8个同样大小的方块组成,每个方块颜色均不相同,可用数字1-8分别表示.任一时刻魔板的状态可用方块的颜色…
题目描述: 代码如下: #include <stdio.h> #include <stdlib.h> #include <string.h> #define N 1000000 #define HN 1000003 #define LEN 9 int head[HN],next[N]; int st[N][LEN], goal[LEN]; int dis[N]; //记录步数 int Hash(int *st)//获取本次排列组合的哈希值 { int i,v; v =…