
递归 & DFS
文章平均质量分 80
FFOYeah
这个作者很懒,什么都没留下…
展开
-
递归总结:八皇后问题(N皇后问题)、汉诺塔(N阶汉诺塔)、全排列问题
1.八皇后问题原创 2018-07-11 21:57:54 · 660 阅读 · 0 评论 -
#二分、二叉树# 一节左神公开课的题解
题目1:二分查找局部最小值 Description:定义局部最小的概念。arr 长度为1时,arr[0] 是局部最小。arr的长度为 N(N > 1) 时,如果 arr[0] < arr[1],那么 arr[0] 是局部最小;如果 arr[N-1] < arr[N-2],那么 arr[N-1] 是局部最小;如果 0 < i< N-1,既有 arr[i] &...原创 2018-08-25 23:23:17 · 302 阅读 · 0 评论 -
#递归、DP# 2749: 分解因数
题目链接:http://bailian.openjudge.cn/practice/2749/描述给出一个正整数a,要求分解成若干个正整数的乘积,即a = a1 * a2 * a3 * ... * an,并且1 < a1 <= a2 <= a3 <= ... <= an,问这样的分解的种数有多少。注意到a = a也是一种分解。输入第1行是测试数据的组数...原创 2018-09-17 21:55:58 · 418 阅读 · 1 评论 -
#DFS序+二分+前缀和# Codeforces Round #381 (Div. 1) B. Alyona and a tree
题目链接B. Alyona and a treetime limit per test 2 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputAlyona has a tree with n vertices. The root of the tre...原创 2018-08-06 09:59:16 · 324 阅读 · 0 评论 -
Codeforces Round #430 (Div. 2) C. Ilya And The Tree
题目链接C. Ilya And The Treetime limit per test 2 secondsmemory limit per test 256 megabytesIlya is very fond of graphs, especially trees. During his last trip to the forest Ilya found a very inte...原创 2018-07-19 02:54:29 · 199 阅读 · 0 评论 -
#树上DFS# Codeforces Round #403 (Div. 2) C. Andryusha and Colored Balloons
Codeforces Round #403 CAndryusha goes through a park each day. The squares and paths between them look boring to Andryusha, so he decided to decorate them. The park consists of n squares connected原创 2018-01-29 00:48:19 · 233 阅读 · 0 评论 -
#DFS、期望# Codeforces Round #428 (Div. 2) C. Journey
题目链接:https://codeforces.com/contest/839/problem/CC. JourneyThere are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other by the roa...原创 2019-01-17 15:18:02 · 283 阅读 · 0 评论 -
【DFS】codeforces 638 B. Making Genome in Berland
题目链接Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we’ve ...原创 2019-03-11 21:52:11 · 342 阅读 · 0 评论 -
【数论】【DP】【LCM】2018 USP-ICMC【待补】
比赛传送门A. Nicoleta and the circle of kidsDescription每个人可以连边,最远连到第(i+k)%n 个人,边权为两个人之间的距离,求最大生成树Range1 ≤ K < N ≤ 1e9Solution方案一:LCM如果每个人都选取最优的连边策略,假设在人数可以无限扩大的前提下,那么每个人都可以向接下来的第k个人连边,很容易得出一个循环节...原创 2019-04-15 01:28:54 · 535 阅读 · 6 评论