POJ
文章平均质量分 71
Iredescence
这个作者很懒,什么都没留下…
展开
-
POJ 2479 Dual Core CPU|网络流|dinic模版
问题描述总时间限制:15000ms单个测试点时间限制:5000ms内存限制:65536kB描述As more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft Corporation, decided to update their famous product - SWODNIW.The rout...原创 2021-01-18 18:25:38 · 181 阅读 · 0 评论 -
POJ 461Power Network|网络流|dinic
问题描述总时间限制:2000ms内存限制:65536kB描述A power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of power, may produce an amount 0 <= p(u) <= ..原创 2021-01-18 18:23:24 · 161 阅读 · 0 评论 -
POJ 275 Drainage Ditches|网络流|dinic模版
问题描述总时间限制:1000ms内存限制:65536kB描述Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Thus, Farmer John has buil..原创 2021-01-18 18:21:30 · 132 阅读 · 0 评论 -
POJ 1396 Checking an Alibi|Dijkstra
问题描述总时间限制:1000ms内存限制:65536kB描述A crime has been comitted: a load of grain has been taken from the barn by one of FJ's cows. FJ is trying to determine which of his C (1 <= C <= 100) cows is the culprit. Fortunately, a passing satellite took an ..原创 2021-01-17 23:44:27 · 145 阅读 · 0 评论 -
POJ 862 Currency Exchange|Bellman-Ford|环检测
题目描述总时间限制:1000ms内存限制:65536kB描述Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There can be several points..原创 2021-01-17 21:51:55 · 107 阅读 · 0 评论 -
POJ 1481 Maximum sum|动态规划
题目描述总时间限制:1000ms内存限制:65536kB描述Given a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below: t1 t2 d(A) = max{ ∑ai + ∑aj | 1 <= s1 <= t1 < s2 <= t2 <= n } i..原创 2021-01-16 12:56:19 · 311 阅读 · 0 评论 -
POJ 172 Shopping Offers|动态规划|状态压缩
题目描述总时间限制:1000ms 内存限制:65536kB描述In a shop each kind of product has a price. For example, the price of a flower is 2 ICU (Informatics Currency Units) and the price of a vase is 5 ICU. In order to attract more customers, the shop introduces some s...原创 2021-01-14 15:45:35 · 177 阅读 · 0 评论 -
POJ 1578 Tug of War|背包问题|动态规划
问题描述总时间限制:3000ms 内存限制:65536kB描述A tug of war is to be arranged at the local office picnic. For the tug of war, the picnickers must be divided into two teams. Each person must be on one team or the other; the number of people on the two teams must no..原创 2021-01-13 15:33:34 · 453 阅读 · 0 评论 -
POJ 653 Multiplication Puzzle|区间动规
题目描述总时间限制:1000ms 内存限制:65536kB描述The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number of points equal to the product of the numb..原创 2021-01-12 21:29:28 · 138 阅读 · 0 评论 -
POJ 82 Human Gene Functions|动态规划
题目描述总时间限制:1000ms 内存限制:65536kB描述It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been interested in identifying human genes ..原创 2021-01-12 21:21:39 · 236 阅读 · 0 评论 -
POJ 2659 Raid|分治法|平面最近点对
题目描述总时间限制:1000ms 内存限制:65536kB描述After successive failures in the battles against the Union, the Empire retreated to its last stronghold. Depending on its powerful defense system, the Empire repelled the six waves of Union's attack. After several sle..原创 2021-01-11 23:10:18 · 425 阅读 · 0 评论 -
POJ 16453 重要逆序对|归并排序
题目描述总时间限制:1000ms 内存限制:256000kB描述给定N个数的序列a1,a2,...aN,定义一个数对(ai, aj)为“重要逆序对”的充要条件为 i < j 且ai> 2aj。求给定序列中“重要逆序对”的个数。输入本题有多个测试点,每个测试点分为两行:第一行为序列中数字的个数N(1 ≤ N ≤ 200000),第二行为序列a1, a2 ... aN(0 ≤a ≤ 10000000),由空格分开。N=0表示输入结束。输出每个测试点一行,输出一个整...原创 2021-01-11 17:08:55 · 1293 阅读 · 0 评论 -
POJ 260 Agri-Net|最小生成树|Prim & Kruskal
问题描述总时间限制:1000ms内存限制:65536kB描述Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course.Farmer John ordered a high speed connect...原创 2021-01-10 20:16:21 · 134 阅读 · 0 评论 -
POJ 330 Radar Installation|贪心法
题目描述总时间限制:1000ms 内存限制:65536kB描述Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locating on the coasting, can on...原创 2021-01-10 16:06:01 · 71 阅读 · 0 评论 -
POJ 5941 Huffman编码树|最小堆
题目描述总时间限制: 1000ms 内存限制:65535kB描述构造一个具有n个外部节点的扩充二叉树,每个外部节点Ki有一个Wi对应,作为该外部节点的权。使得这个扩充二叉树的叶节点带权外部路径长度总和最小:Min( W1 * L1 + W2 * L2 + W3 * L3 + … + Wn * Ln)Wi:每个节点的权值。Li:根节点到第i个外部叶子节点的距离。编程计算最小外部路径长度总和。...原创 2021-01-10 14:42:17 · 277 阅读 · 0 评论 -
POJ 5470 去除C程序中的注释
描述C程序的注释用/*...*/来表示。请写一个程序,将输入的C程序源代码中的注释去掉,输出去掉注释之后的源代码。用于测试的C代码保证符合语法,不使用C++的//注释语法。注意,C语言不允许出现嵌套注释。具体来说,对于/*/**/"*/",如果不允许嵌套注释,那么它表示字符串"*/";如果允许嵌套注释,它表示一个引号"。还请注意,字符串中出现的注释符/*属于字符串的一部分,注释中出现的双引号"属于注释的一部分。输入符合语法的C代码文本文件。代码每行不超过200个字符。输出去掉原创 2021-01-07 14:21:25 · 540 阅读 · 0 评论 -
POJ 8200 汉诺塔问题(Hanoi) 递归
描述一、汉诺塔问题有三根杆子A,B,C。A杆上有N个(N>1)穿孔圆盘,盘的尺寸由下到上依次变小。要求按下列规则将所有圆盘移至C杆: 每次只能移动一个圆盘; 大盘不能叠在小盘上面。 提示:可将圆盘临时置于B杆,也可将从A杆移出的圆盘重新移回A杆,但都必须遵循上述两条规则。问:如何移?最少要移动多少次?汉诺塔示意图如下:三个盘的移动:二、故事由来法国数学家爱德华·卢卡斯曾编写过一个印度的古老传说:在世界中心贝拿勒斯(在印度北部)的圣庙里,一块黄铜...原创 2021-01-07 13:16:28 · 213 阅读 · 0 评论 -
POJ 6376 二维数组右上左下遍历
开始复习算法课!题目刷起来!第一道热身题:二维数组右上左下遍历描述给定一个row行col列的整数数组array,要求从array[0][0]元素开始,按从左上到右下的对角线顺序遍历整个数组。输入输入的第一行上有两个整数,依次为row和col。余下有row行,每行包含col个整数,构成一个二维整数数组。(注:输入的row和col保证0 < row < 100, 0 < col < 100)输出按遍历顺序输出每个整数。每个整数占一行。样例输入原创 2021-01-05 23:55:56 · 172 阅读 · 0 评论 -
POJ 7620 区间合并|简单贪心法
描述给定 n 个闭区间 [ai; bi],其中i=1,2,...,n。任意两个相邻或相交的闭区间可以合并为一个闭区间。例如,[1;2] 和 [2;3] 可以合并为 [1;3],[1;3] 和 [2;4] 可以合并为 [1;4],但是[1;2] 和 [3;4] 不可以合并。我们的任务是判断这些区间是否可以最终合并为一个闭区间,如果可以,将这个闭区间输出,否则输出no。输入第一行为一个整数n,3 ≤ n ≤ 50000。表示输入区间的数量。之后n行,在第i行上(1 ≤ i ≤ n),为两个整数原创 2021-01-07 13:33:07 · 133 阅读 · 0 评论 -
POJ 2867 Red and Black|DFS
描述There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles原创 2021-01-07 16:33:17 · 125 阅读 · 0 评论 -
POJ 8895 Percolation|并查集
问题描述总时间限制: 1000ms 内存限制: 32768kB描述定义一个N行N列的矩阵,矩阵中的每个元素是个方格,每个方格有两种可能的状态:开通的或关闭的。初始时,所有方格都是关闭的。输入数据的每一步会指定矩阵中某个原来关闭的方格变成开通的。要求编写程序判断当前是否存在从矩阵中最上面一行的任何一个开着的方格走到最下面一行的任何一个开着的方格的路径。如果存在的话,输出当前的步数。比如走到第14步时,矩阵变成上下通透的,那么就输出14。注意:输入数据中只会把矩阵中的一部分方格打开。如果所有步骤..原创 2021-01-09 20:52:20 · 518 阅读 · 1 评论 -
POJ 1369 Genealogical tree|拓扑排序
问题描述http://algorithm.openjudge.cn/2020hw1/2B/总时间限制:1000ms 内存限制:65536kB描述The system of Martians' blood relations is confusing enough. Actually, Martians bud when they want and where they want. They gather together in different groups, so that a Ma..原创 2021-01-09 19:18:25 · 91 阅读 · 0 评论 -
POJ 8594 Butterfly|二部图染色
题目描述总时间限制:1000ms单个测试点时间限制:100ms内存限制:65536kB描述有一群旅行爱好者,有一天,他们带回了n只蝴蝶回来。他们相信每一只都属于两个不同种类中的一种,为了讨论方便,我们称它们为A与B。他们想把n只标本分成两组——一些属于A且一些属于B——但是直接标记任何一个标本对于他们是非常困难,因此他们决定采用下面的方法。对每对标本i和j,他们细心地把它们放到一起研究。如果他们以自己的判断足以确信,那么他们把这对蝴蝶标记为“相同”(这意味着他们相信...原创 2021-01-09 15:09:44 · 363 阅读 · 0 评论 -
POJ 1257 重建二叉树|递归
总时间限制:1000ms内存限制:65536kB描述给定一棵二叉树的前序遍历和中序遍历的结果,求其后序遍历。输入输入可能有多组,以EOF结束。每组输入包含两个字符串,分别为树的前序遍历和中序遍历。每个字符串中只包含大写字母且互不重复。输出对于每组输入,用一行来输出它后序遍历结果。样例输入DBACEGF ABCDEFGBCAD CBAD样例输出ACBFGEDCDAB#include <iostream>#inc...原创 2021-01-07 16:36:08 · 164 阅读 · 0 评论