
搜索/回溯
文章平均质量分 91
synapse7
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #147 (Div. 2) / 237B Young Table (搜索)
B. Young Tablehttp://codeforces.com/problemset/problem/237%2FBtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output原创 2013-08-26 09:16:03 · 1034 阅读 · 0 评论 -
UVa 10717 Mint (DFS枚举4个数的lcm)
10717 - MintTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=115&page=show_problem&problem=1658The Royal Canadian Mint has commissioned a原创 2013-11-03 14:23:58 · 1205 阅读 · 0 评论 -
POJ 1979 Red and Black (DFS)
Red and Blackhttp://poj.org/problem?id=1979Time Limit: 1000MSMemory Limit: 30000KDescriptionThere is a rectangular room, covered with square tiles. Each tile is colored eit原创 2013-11-06 21:32:28 · 1232 阅读 · 0 评论 -
NWERC 2007 / UVa 12124 Assemble (二分搜索&最小值最大问题)
12124 - AssembleTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=456&page=show_problem&problem=3276Recently your team noticed that the原创 2013-11-10 22:24:57 · 1299 阅读 · 0 评论 -
UVa 1267 Network (DFS&贪心)
1267 - NetworkTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=456&page=show_problem&problem=3708Consider a tree network with n nodes w原创 2013-11-11 08:39:19 · 1144 阅读 · 0 评论 -
POJ 2251 Dungeon Master (BFS)
Dungeon Masterhttp://poj.org/problem?id=2251Time Limit: 1000MSMemory Limit: 65536KDescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dung原创 2013-11-10 14:20:48 · 1346 阅读 · 0 评论 -
UVa 11210 Chinese Mahjong (模拟&枚举&回溯)
11210 - Chinese MahjongTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=2151Mahjong () is a game of Chinese origin usually played by原创 2013-10-13 21:19:55 · 917 阅读 · 0 评论 -
CERC 2004 / UVa 1335 Beijing Guards (二分&贪心&想法题)
1335 - Beijing GuardsTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=456&page=show_problem&problem=4081Beijing was once surrounded by原创 2013-11-11 12:21:48 · 1292 阅读 · 0 评论 -
UVa 10308 Roads in the North (树上的最长路)
10308 - Roads in the NorthTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=115&page=show_problem&problem=1249思路:由于是一棵树,我们只要随便指定一个树根就开原创 2013-11-26 18:18:39 · 1631 阅读 · 2 评论 -
POJ 3126 / Northwestern Europe 2006 Prime Path (数论&BFS)
Prime Pathhttp://poj.org/problem?id=3126Time Limit: 1000MSMemory Limit: 65536KDescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Secu原创 2013-08-25 13:56:44 · 1136 阅读 · 0 评论 -
UVa 167 The Sultan's Successors (八皇后问题)
167 - The Sultan's SuccessorsTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=103The Sultan of Nubia has n原创 2013-10-16 14:40:02 · 1467 阅读 · 0 评论 -
Codeforces Round #218 (Div. 2) / 371C Hamburgers (二分)
http://codeforces.com/contest/371/problem/C直接二分能做的汉堡数,注意上界要开大一点。完整代码:/*15ms,0KB*/#includeusing namespace std;const long long mx = 1e13;///多开一位,因为结果可以略大于1e12const char b[] = "BSC";原创 2014-03-12 12:15:33 · 1002 阅读 · 0 评论 -
Codeforces Beta Round #87 (Div. 2) / 116C Party (DFS&树的最大深度)
http://codeforces.com/problemset/problem/116/C从树根DFS,看最大能递归几层。/*30ms,300KB*/#includeusing namespace std;const int mx = 2005;vector v[mx];bool fa[mx];int maxlen;void dfs(int i, int原创 2014-03-09 10:28:20 · 1313 阅读 · 0 评论 -
Codeforces Beta Round #87 (Div. 2) / 116D Lawnmower (讨论情况)
http://codeforces.com/problemset/problem/116/D/*30ms,0KB*/#includeconst int mx = 155;char g[mx][mx];int left[mx], right[mx];int main(){ int n, m, i, j, posy, dir; int cnt = -1; scanf原创 2014-03-09 10:38:40 · 1158 阅读 · 0 评论 -
UVa 200 Rare Order (拓扑排序)
200 - Rare OrderTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=136题意:给一列单词,这些单词是按一种未知的字典顺序排列的,要求输出这些字母原创 2013-11-18 12:28:07 · 2036 阅读 · 0 评论 -
UVa 331 Mapping the Swaps (DFS)
331 - Mapping the SwapsTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=267Sorting an array can be done b原创 2013-10-29 08:31:28 · 934 阅读 · 0 评论 -
Codeforces Round #196 (Div. 2) / 337A Puzzles (搜索)
A. Puzzleshttp://codeforces.com/contest/337/problem/Atime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTh原创 2013-08-17 10:48:26 · 1438 阅读 · 0 评论 -
UVa 340 Master-Mind Hints (优化查找&复制数组)
学英语:1. Match (i,j) is called strong when i =j, and is called weak otherwise.当i=j时,匹配(i,j)被叫做强匹配,反之叫做弱匹配。2. Two matches (i,j) and (p,q) are called independent when i = p if and only if j = q. A set of matches is called independent when all of its members原创 2013-09-30 00:22:56 · 1985 阅读 · 0 评论 -
UVa 439/HDU 1372/POJ 2243/ZOJ 1091 Knight Moves(BFS&纯数学方法)
439 - Knight MovesTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=105&page=show_problem&problem=380http://acm.hdu.edu.cn/showproblem.php?原创 2013-08-03 19:35:48 · 1285 阅读 · 0 评论 -
UVa 524 Prime Ring Problem (数论&DFS)
524 - Prime Ring ProblemTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=465A ring is composed of n (even number) circl原创 2013-09-13 16:20:38 · 1313 阅读 · 0 评论 -
UVa 129 Krypton Factor (回溯好题)
129 - Krypton FactorTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=65You have been employed by the organisers of a Super Krypton F原创 2013-10-14 21:59:31 · 1012 阅读 · 0 评论 -
UVa 10344 23 out of 5 (全排列枚举&回溯)
10344 - 23 out of 5Time limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1285Your task is to write a program t原创 2013-10-16 18:05:41 · 1097 阅读 · 0 评论 -
UVa 110 Meta-Loopless Sorts (递归&代码模拟&全排列)
110 - Meta-Loopless SortsTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=46Background Sorting holds an im原创 2013-09-25 18:13:32 · 1145 阅读 · 0 评论 -
UVa 10474 Where is the Marble? (二分查找&equal_range()的使用)
10474 - Where is the Marble?Time limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=1415Raju and Meena love to pl原创 2013-10-16 14:10:06 · 1098 阅读 · 0 评论 -
UVa 10562 Undraw the Trees (二叉树先序遍历)
10562 - Undraw the TreesTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=104&page=show_problem&problem=1503Professor Homer has been rep原创 2013-10-24 16:11:35 · 1225 阅读 · 0 评论 -
UVa 839 Not so Mobile (DFS二叉树)
839 - Not so MobileTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=104&page=show_problem&problem=780Before being an ubiquous communica原创 2013-10-24 19:31:40 · 1015 阅读 · 0 评论 -
UVa 639 Don't Get Rooked (DFS好题)
639 - Don't Get RookedTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=580In chess, the rook is a piece t原创 2013-10-25 08:51:48 · 1229 阅读 · 0 评论 -
UVa 699 The Falling Leaves (DFS遍历二叉树)
699 - The Falling LeavesTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=640Each year, fall in the North Central regio原创 2013-10-26 22:47:34 · 1076 阅读 · 0 评论 -
UVa 140 Bandwidth (枚举全排列&剪枝搜索)
140 - BandwidthTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=76Given a graph (V,E) where V is a set of原创 2013-10-29 08:04:18 · 1141 阅读 · 0 评论 -
UVa 548 Tree (中序遍历&后序遍历&DFS)
548 - TreeTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=104&page=show_problem&problem=489You are to determine the value of the leaf原创 2013-10-28 15:08:10 · 957 阅读 · 0 评论 -
Codeforces Round #197 (Div. 2) / 339C Xenia and Weights (爆搜)
http://codeforces.com/contest/339/problem/C爆搜水过,复杂度貌似是O(m)的?/*62ms,4KBm*/#includeint m, ans[1005]; ///ans从1开始char s[15];bool ok;///O(m)复杂度?int dfs(int deep, int diff) /// diff表示重量之差{原创 2014-03-14 16:24:46 · 1354 阅读 · 0 评论