感觉可以用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
Sudoku Solver
Total Accepted: 11752 Total
Submissions: 56537My Submissions
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character...
分类:
其他好文 时间:
2014-09-06 22:37:04
阅读次数:
244
We all know about the legend oftower of Hanoi. It is said that the world will end after finishing the puzzle.What we don't know is another legend about when the world will end which is verifiedby the ...
分类:
其他好文 时间:
2014-09-06 17:26:13
阅读次数:
250
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-02 22:46:45
阅读次数:
227
题目链接:uva 1399 - Puzzle
题目大意:给定K和N,表示有K种不同的字符,N个禁止串,求一个最长的串使得该串不包含任何禁止串为子串。如果存在循环或者不能构成的话,输出No。
解题思路:建立AC自动机,然后在AC自动机上做dp,所有单词结尾节点为禁止点。
#include
#include
#include
#include
using namespace s...
分类:
其他好文 时间:
2014-09-01 22:45:53
阅读次数:
211
传送门题目描述Mayan puzzle 是最近流行起来的一个游戏。游戏界面是一个 7行 5 列的棋盘,上面堆放着一些方块,方块不能悬空堆放,即方块必须放在最下面一行,或者放在其他方块之上。游戏通关是指在规定的步数内消除所有的方块,消除方块的规则如下: 1、 每步移动可以且仅可以沿横向(即向左或向右)...
分类:
其他好文 时间:
2014-08-31 11:52:11
阅读次数:
225
A hard puzzle
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 29415 Accepted Submission(s): 10581
Problem Description
lcy gives ...
分类:
其他好文 时间:
2014-08-27 22:00:18
阅读次数:
232