暴力
crella___
当你还不能写出自己满意的程序时,你就不要去睡觉。
展开
-
Editing a Book UVA - 11212(IDA*)
#include<cstdio> #include<cstring> using namespace std; int s[10];//状态空间搜索 int n; int h() //后续不正确排列数字个数 { int cnt = 0; for (int i = 0; i < n - 1; i++) if (s[i] + 1 != s[i + 1])原创 2017-04-27 13:35:48 · 605 阅读 · 0 评论 -
Power Calculus UVA - 1374(IDA* 状态空间搜索)
#include<cstdio> #include<cstring> using namespace std;int n, a[14]; //注意选择设定的状态bool dfs(int d, int maxd) { if (a[d] == n) return true; if (d == maxd) //若当d达到maxd然而仍然达不到目标状态,则退出并返回错//原创 2017-04-28 08:38:33 · 285 阅读 · 0 评论 -
UVA1354 (枚举二叉树)
给出房间的宽度,以及n个重物的重量,每个杆的长度为1,要求如图放置的宽度尽量宽但又不超过房间的宽度。输出保留10为小数即可。枚举二叉树 需用第九章的枚举子集高速算法重做一遍#include<cstdio> #include<vector> #include<algorithm> #include<cstring> using namespace std; const int maxn = 6;in原创 2017-04-26 19:36:36 · 688 阅读 · 0 评论 -
The Morning after Halloween(POJ - 3523)(状态空间搜索)
给出w*h的网格,相当于迷宫,有大写字母和小写字母,算出小写字母走到大写字母状态时的最少步数。另有双向搜索解和A*解#include<cstdio> #include<queue> #include<cstring> //#include<vector> #include<cctype> using namespace std; const int maxs = 20, maxn = 150;//原创 2017-04-27 11:09:38 · 358 阅读 · 0 评论 -
Zombie's Treasure Chest UVA - 12325(枚举)
贪心不可用#include<cstdio> #include<cmath> #include<algorithm> using namespace std; typedef long long LL; int main() { int T, kase = 0; scanf("%d", &T); while (T--) { int n, s1, v1,原创 2017-04-27 14:49:26 · 248 阅读 · 0 评论 -
The Rotation Game UVA - 1343(IDA* 状态空间搜索)
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int line[8][7] = // lines E~H are computed with the help of rev[] //用一系列“指针”将一维数组构造为特殊形态数据结构储存数据//修改时通过存储的特殊形态“指针”查询一维数组修改其原创 2017-04-27 21:47:23 · 301 阅读 · 0 评论