Sawtooth Puzzle
Time Limit: 10 Seconds Memory Limit: 65536 KB
Recently, you found an interesting game called Sawtooth Puzzle. This is a single-player game played on a grid with 3 x 3 cells....
分类:
其他好文 时间:
2014-09-11 09:42:44
阅读次数:
248
Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be o...
分类:
其他好文 时间:
2014-09-11 07:39:41
阅读次数:
161
ZOJ 3814 Sawtooth Puzzle
题目链接
记录状态广搜,把9个拼图都压缩成一个状态,然后去搜索,就是模拟的过程比较麻烦
代码:
#include
#include
#include
#include
#include
using namespace std;
typedef unsigned long long ll;
int t;
int...
分类:
其他好文 时间:
2014-09-10 17:47:50
阅读次数:
220
题目链接:zoj 3814 Sawtooth Puzzle
题目大意:给定一个9宫拼图,每次可以挑选一个位置顺时针旋转,和普通拼图不一样的是每块拼图周围可能有齿转动一个可能导致全部拼图转变。
解题思路:隐式图搜索,9块拼图最多49个状态,对于每个状态枚举转动的位置,考虑转动的状态。一开始转移是用bfs写的,但是由于频繁申请队列,然后时间爆了
#include
#include
#...
分类:
其他好文 时间:
2014-09-10 12:32:50
阅读次数:
256
N-Queens
Total Accepted: 14054 Total
Submissions: 54127My Submissions
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other...
分类:
其他好文 时间:
2014-09-10 09:39:00
阅读次数:
272
Solve the puzzle, Save the world!Problem DescriptionIn the popular TV series Heroes, there is a tagline "Save the cheerleader, Save the world!". Here ...
分类:
其他好文 时间:
2014-09-09 23:01:19
阅读次数:
387
感觉可以用BFS撸,然后就撸了,样例无限不过,代码能力真是弱。。#include #include #include #include #include using namespace std;const int bufsize = 128;char buf[bufsize][bufsize];st...
分类:
其他好文 时间:
2014-09-07 20:59:35
阅读次数:
320
由于一个框框只有4种状态,总状态数只有4^9,bfs可解。
麻烦的地方就在于模拟。
我的状态的存法是,将初始状态看做000000000,若顺时针旋转一次就+1, 3+1=0。
bfs的过程中,需要套一个dfs计算旋转当前框框会影响到哪些框。
有个地方要注意,就是目标状态其实不止一种,因为有些框框旋转之后不变,我们必须把所有可能的目标状态都计算出来,样例的中间那个框框就是这种情况。
#in...
分类:
其他好文 时间:
2014-09-07 19:53:05
阅读次数:
276
题目如下:
Problem A
The Most Distant State
Input: standard input
Output: standard output
The 8-puzzle is a square tray inwhich eight square tiles are placed. The remaining ninth square is uncove...
分类:
其他好文 时间:
2014-09-07 13:35:55
阅读次数:
284
Sudoku Solver
Total Accepted: 11799 Total
Submissions: 56732My Submissions
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character...
分类:
其他好文 时间:
2014-09-07 13:33:25
阅读次数:
184