原创 HDU 3362 Fix (狀態壓縮DP)
題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=3362 題目大意:給出n(n<=18)個點的座標,某些點固定了,某些點沒固定,要求加一些邊使得沒固定的點變成固定,求最小花費。 思路:n比
原创 POJ 3139 / LA 3693 Balancing the Scale (枚舉,狀態壓縮)
傳送門:http://poj.org/problem?id=3139 題目大意:給出16個不大於1024數,每個數只使用一次,求使得下列等式成立的方案數。 x1 * 4 + x2 * 3 + x3 * 2 + x4 = x5 +
原创 HDU 1043 Eight (經典八數碼問題,BFS+狀態枚舉+僞哈希)
傳送門:http://acm.hdu.edu.cn/showproblem.php?pid=1043 題目大意:經典的八數碼問題,給定狀態,求移回原始按順序的序列的操作序列。 思路:從狀態”12345678x“開始BFS下去,逐漸
原创 Light OJ 1109 - False Ordering
1109 - False Ordering PDF (English) Statistics Forum Tim
原创 ZOJ 3712 Hard to Play
Hard to Play Time Limit: 2 Seconds Memory Limit: 65536 KB MightyHorse is playing a music game called osu!. Af
原创 UVA 562 CD (DP+DFS)
01揹包: /* W w w mm mm 222222222 7777777777777 */ /* W
原创 POJ3278 Catch That Cow(BFS入門)
Catch That Cow Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 43276 Accepted: 13472 Description F
原创 LA 3621 / POJ 3134 Power Calculus (迭代加深搜索)
題目鏈接:http://poj.org/problem?id=3134 題目大意:給出x和正整數n(1<=n<=1000),問最少需要幾次乘除法可以得到x^n。 解法:n比較小,迭代加深搜索,淺層內求出解,加上剪枝就OK了。 迭代加
原创 hdu 1251 (字典樹 Trie 模板題)
模板題 : /* W w w mm mm 222222222 7777777777777 */ /* W
原创 UVA 11462 Age Sort
Age Sort Input: Standard Input Output: Standard Output You are given the ages (in years) of all people of a country
原创 ZOJ Problem Set - 3702 Gibonacci number
Gibonacci number Time Limit: 2 Seconds Memory Limit: 65536 KB In mathematical terms, the normal sequence F(n) of
原创 Codeforces Round #243 (Div. 2) C. Sereja and Swaps
#include<stdio.h> #include<algorithm> using namespace std; int main() { freopen("in2.txt","r",stdin); in
原创 Light OJ 1045 Digits of Factorial(求位數)
1045 - Digits of Factorial PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Factorial o
原创 POJ 3624 Charm Bracelet
Charm Bracelet Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20499 Accepted: 9293 Description Be
原创 HDU 4597 Play Game (DP,記憶化搜索,博弈)
傳送門:http://acm.hdu.edu.cn/showproblem.php?pid=4597 大致題意:給出2堆數,Alice和Bob輪流拿,每次只能從每堆數的頭或尾取,Alice先取,兩人都採取最優策略,求Alice最後最多能