![](https://img-blog.csdnimg.cn/20190729191539224.jpeg?x-oss-process=image/resize,m_fixed,h_224,w_224)
AC题解
文章平均质量分 92
课下笔记
Wen阿杜
..............
展开
-
Good Numbers (hard version) CodeForces - 1249C2
Problem DescriptionThe only difference between easy and hard versions is the maximum value of nnn.You are given a positive integer number n. You really love good numbers so you want to find the smal...原创 2019-12-06 19:35:10 · 239 阅读 · 0 评论 -
Good Numbers (hard version) CodeForces - 1249C2
Problem DescriptionThe only difference between easy and hard versions is the maximum value of nnn.You are given a positive integer number nnn. You really love good numbers so you want to find the sm...原创 2019-10-30 19:50:10 · 452 阅读 · 0 评论 -
Minimizing Difference CodeForces - 1244E
Problem DescriptionYou are given aaa sequence a1,a2,…,ana_{1},a_{2},…,a_{n}a1,a2,…,an consisting of nnn integers.You may perform the following operation on this sequence: choose any element and ei...原创 2019-10-19 10:17:35 · 271 阅读 · 0 评论 -
Harmonic Number (II) LightOJ - 1245 (找规律)
Problem DescriptionI was trying to solve problem ‘1234 - Harmonic Number’, I wrote the following codelong long H( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) res = ...原创 2019-08-08 20:37:02 · 267 阅读 · 0 评论 -
Trees on the level HDU - 1622(二叉树)
Problem DescriptionTrees are fundamental in many branches of computer science. Current state-of-the art parallel computers such as Thinking Machines’ CM-5 are based on fat trees. Quad- and octal-tree...原创 2019-08-08 14:58:18 · 301 阅读 · 0 评论 -
Binary Tree Traversals HDU - 1710(简单推树)
Problem DescriptionA binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binary trees called the left and right subtrees. There are three most impor...原创 2019-08-08 14:36:47 · 171 阅读 · 0 评论 -
Elven Postman HDU - 5444 【二叉树查询节点,记录路径】
Problem DescriptionElves are very peculiar creatures. As we all know, they can live for a very long time and their magical prowess are not something to be taken lightly. Also, they live on trees. Ho...原创 2019-08-07 09:17:04 · 182 阅读 · 0 评论 -
【POJ - 3468】线段树的初步了解
线段树:{\color{Red} 线段树:}线段树:线段树是一种二叉搜索树,与区间树相似,它将一个区间划分成一些单元区间,每个单元区间对应线段树中的一个叶结点。使用线段树可以快速的查找某一个节点在若干条线段中出现的次数,时间复杂度为O(logN)O(logN)O(logN)。而未优化的空间复杂度为2N2N2N,实际应用时一般还要开4N4N4N的数组以免越界,因此有时需要离散化让空间压缩。定义...原创 2019-08-06 21:07:19 · 196 阅读 · 0 评论 -
敌兵布阵 HDU - 1166(线段树区间查找与更新)
ProblemDescription\mathfrak{Problem Description}ProblemDescriptionCCC国的死对头A国这段时间正在进行军事演习,所以CCC国间谍头子DerekDerekDerek和他手下TidyTidyTidy又开始忙乎了。AAA国在海岸线沿直线布置了NNN个工兵营地,DerekDerekDerek和Tidy的任务就是要监视这些工兵营地的活动情况...原创 2019-08-06 19:27:09 · 114 阅读 · 0 评论 -
HDU-1506 Largest Rectangle in a Histogram
Problem DescriptionA histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figur...原创 2019-08-06 17:37:14 · 115 阅读 · 0 评论 -
Tree Recovery UVA - 536(二叉树的遍历)
Problem DescriptionLittle Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes.This is an example of...原创 2019-08-06 10:54:42 · 165 阅读 · 0 评论 -
二叉树前中后的遍历
二叉树:{\color{Red} 二叉树:}二叉树:简单的介绍一下二叉树:二叉树是每个结点最多有两个子树的树结构。通常子树被称作“左子树”(left subtree)和“右子树”(right subtree)。二叉树常被用于实现二叉查找树和二叉堆。一棵深度为k,且有2k−12^{k}-12k−1个节点的二叉树,称为满二叉树。这种树的特点是每一层上的节点数都是最大节点数。而在一棵二叉树中,除最...原创 2019-08-06 00:12:22 · 173 阅读 · 0 评论 -
快速幂和矩阵
这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入欢迎使用Ma...原创 2019-07-19 10:01:00 · 116 阅读 · 0 评论 -
POJ - 2528【线段树+离散】Mayor's posters
ProblemDescription\mathfrak{Problem Description}ProblemDescriptionThe citizens of Bytetown, ABABAB, could not stand that the candidates in the mayoral election campaign have been placing their electo...原创 2019-08-05 12:14:21 · 169 阅读 · 0 评论 -
【线段树】A Simple Problem with Integers poj ——3468
A Simple Problem with IntegersYou have NNN integers, A1,A2,...,ANA1, A2, ... , ANA1,A2,...,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each...原创 2019-08-05 09:47:04 · 132 阅读 · 0 评论 -
最短路径的四种算法
最短路径四种算法1234FloydDijkstraBellman-Ford队列优化的Bellman-Ford一,只有四行的算法——Floyd-Warshall假设求顶点ViViVi到VjVjVj的最短路径。弗洛伊德算法依次找从ViViVi到VjVjVj,中间经过结点序号不大于000的最短路径,不大于111的最短路径,…直到中间顶点序号不大于n−1n-1n−1...原创 2019-07-30 19:42:49 · 15028 阅读 · 3 评论 -
Cow Contest POJ - 3660 And Longest Paths UVA - 10000(弗洛伊德的应用)
N(1≤N≤100)N (1 ≤ N ≤ 100)N(1≤N≤100) cows, conveniently numbered 1..N1..N1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain cons...原创 2019-07-31 19:27:49 · 234 阅读 · 0 评论 -
Ice_cream's world I HDU - 2120(并查集,求环数)
Problem Descriptionice_cream’s world is a rich country, it has many fertile lands. Today, the queen of ice_cream wants award land to diligent ACMers. So there are some watchtowers are set up, and wal...原创 2019-07-31 11:36:12 · 163 阅读 · 0 评论 -
A Walk Through the Forest HDU - 1142(最短路+记忆)
Problem DescriptionJimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things even ni...原创 2019-07-31 11:08:41 · 189 阅读 · 0 评论 -
find the longest of the shortest HDU - 1595(最短路径之记录路径)
Problem DescriptionMarica is very angry with Mirko because he found a new girlfriend and she seeks revenge.Since she doesn’t live in the same city, she started preparing for the long journey.We know ...原创 2019-07-30 15:15:06 · 155 阅读 · 0 评论 -
I. Same String
Problem Description单点时限内存限制2.0 sec512 MB有两个只由小写字母组成的长度为nnn的字符串s1,s2s1,s2s1,s2和mmm组字母对应关系,每一组关系由两个字母c1c1c1和c2c2c2组成,代表c1c1c1可以直接变成c2c2c2,你需要判断s1s1s1是否可以通过这m组关系转换为s2s2s2。输入格式第一行输入一个n(1≤...原创 2019-07-28 19:04:59 · 145 阅读 · 0 评论 -
B. 恐怖的怪物(bfs搜索)
Problem Description单点时限内存限制5.0512MB一天早上,Dicer一觉醒来,发现自己来到了MineCraft的世界里面,身为MineCraft游戏爱好者的他欣喜不已,于是他在地下挖了一片长方体的空间作为秘密基地,可是他发现光照亮度小于等于777时,会有恐怖的怪物出现,并且他通过查阅资料发现光源方块产生光照每一米(方格)衰减111光照等级。此规...原创 2019-07-28 18:39:28 · 234 阅读 · 0 评论 -
Just Skip The Problem HDU - 6600
Problem DescriptionY_UME has just found a number xxx in his right pocket. The number is a non-negative integer ranging from 00 to 2n2^{n}2n−1 inclusively. You want to know the exact value of this num...原创 2019-07-28 17:26:48 · 170 阅读 · 0 评论 -
Roadblocks POJ - 3255(最短路中的次短路)
Problem DescriptionBessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she likes the scener...原创 2019-07-28 17:01:11 · 141 阅读 · 0 评论 -
Advanced Fruits HDU - 1503
Problem DescriptionThe company “21st Century Fruits” has specialized in creating new sorts of fruits by transferring genes from one fruit into the genome of another one. Most times this method doesn’...原创 2019-07-28 16:34:12 · 554 阅读 · 0 评论 -
A,再战斐波那契
Problem Description单点时限1.0sec内存限制512MB小z 学会了斐波那契和gcdgcdgcd 后,老师又给他出了个难题,求第N个和第M个斐波那契数的最大公约数,这可难倒了小z ,不过在小z 的再三请求下,老师又告诉他了个条件,gcd(N,M)∈[1,90]gcd(N,M)∈[1,90]gcd(N,M)∈[1,90]。可是,笨拙的小z 还是不会,于是...原创 2019-07-27 21:39:20 · 138 阅读 · 0 评论 -
Space Elevator POJ - 2392 And Cash Machine POJ - 1276 (多重背包)
Problem DescriptionThe cows are going to space! They plan to achieve orbit by building a sort of space elevator: a giant tower of blocks. They have K (1 <= K <= 400) different types of blocks w...原创 2019-07-23 00:03:44 · 157 阅读 · 0 评论 -
Bridging signals POJ - 1631 HDU - 1950 (最大上升子序列)
Problem Description’Oh no, they’ve done it again’, cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the signals on the chip c...原创 2019-07-22 21:49:30 · 119 阅读 · 0 评论 -
Alignment POJ - 1836
Problem DescriptionIn the army, a platoon is composed by n soldiers. During the morning inspection, the soldiers are aligned in a straight line in front of the captain. The captain is not satisfied w...原创 2019-07-22 21:26:46 · 145 阅读 · 0 评论 -
Pearls POJ - 1260(简单的dp)
Problem DescriptionIn Pearlania everybody is fond of pearls. One company, called The Royal Pearl, produces a lot of jewelry with pearls in it. The Royal Pearl has its name because it delivers to the ...原创 2019-07-22 21:11:26 · 125 阅读 · 0 评论 -
HDU - 3466 Proud Merchants(排序背包问题)
Problem DescriptionRecently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result, the people in this country are still very p...原创 2019-07-22 20:52:22 · 179 阅读 · 0 评论 -
UVA - 10603 Fill (经典倒水问题)
FillThere are three jugs with a volume of a, b and c liters. (a, b, and c are positive integers not greater than 200). The first and the second jug are initially empty, while the third is completely ...原创 2019-04-17 20:22:37 · 197 阅读 · 0 评论 -
POJ - 1159 Palindrome (回文串与最长公共子序列问题)
Problem DescriptionA palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determi...原创 2019-07-22 10:47:24 · 225 阅读 · 0 评论 -
Zipper HDU - 1501 (DFS)一个搜索题
Problem DescriptionGiven three strings, you are to determine whether the third string can be formed by combining the characters in the first two strings. The first two strings can be mixed arbitraril...原创 2019-07-22 09:35:36 · 170 阅读 · 0 评论 -
最大连续子序列 HDU - 1231
Problem Description给定K个整数的序列{ N1, N2, …, NK },其任意连续子序列可表示为{ Ni, Ni+1, …,Nj },其中 1 <= i <= j <= K。最大连续子序列是所有连续子序列中元素和最大的一个,例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 },最大和为20。...原创 2019-07-21 23:10:58 · 176 阅读 · 0 评论 -
Tempter of the Bone HDU - 1010(剪枝与搜索)
Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He rea...原创 2019-07-21 17:06:13 · 125 阅读 · 0 评论 -
A计划 HDU - 2102 (bfs搜索)
Problem Description可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。现据密探所报,公主被关在一个两层的迷宫里,迷宫的入口是S(0,0,0),公主的位置用...原创 2019-07-21 16:33:45 · 109 阅读 · 0 评论 -
Sticks UVA - 307(剪枝技巧)
Problem DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 unitslong. Now he wants to return sticks to the original state, but he forgot how man...原创 2019-07-21 16:23:42 · 228 阅读 · 0 评论 -
数塔 HDU - 2084 (一个简单的dp)
Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗?Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1 <= N <= 100),表示数...原创 2019-07-21 13:17:55 · 114 阅读 · 0 评论 -
HDU - 2602 Bone Collector 动规01 背包 /// 完全背包
Problem DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave …...原创 2019-07-21 12:53:25 · 119 阅读 · 0 评论