【POJ】
ACMerszl
一事精致,便能动人
展开
-
POJ2456-Aggressive cows
题目链接:点击打开链接DescriptionFarmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000...原创 2018-04-15 09:36:49 · 162 阅读 · 0 评论 -
POJ-2299 Ultra-QuickSort
题目链接:点击打开链接 Ultra-QuickSortTime Limit: 7000MS Memory Limit: 65536K Total Submissions: 68838 Accepted: 25801 DescriptionIn this problem, you have to analyze a particular sor...原创 2018-07-14 15:02:37 · 128 阅读 · 0 评论 -
POJ1094-Sorting It All Out
题目链接:点击打开链接 Sorting It All OutTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 38356 Accepted: 13525 DescriptionAn ascending sorted sequence of distinct values is...原创 2018-07-14 15:07:45 · 128 阅读 · 0 评论 -
POJ1703-Find them, Catch them
题目链接:点击打开链接 Find them, Catch themTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 51710 Accepted: 15831 DescriptionThe police office in Tadu City decides to say e...原创 2018-07-14 15:40:01 · 191 阅读 · 0 评论 -
POJ3349-Snowflake Snow Snowflakes
题目链接:点击打开链接 SnowflakeSnowSnowflakesTime Limit: 4000MS Memory Limit: 65536K Total Submissions: 48324 Accepted: 12621 DescriptionYou may have heard that no two snowflakes are...原创 2018-07-15 16:39:07 · 173 阅读 · 0 评论 -
POJ2151-Check the difficulty of problems
题目链接:点击打开链接 Check the difficulty of problemsTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 8583 Accepted: 3656 DescriptionOrganizing a programming contest is no...原创 2018-07-15 17:02:59 · 133 阅读 · 0 评论 -
POJ3274-Gold Balanced Lineup
题目链接:点击打开链接 Gold Balanced LineupTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 16978 Accepted: 4796 DescriptionFarmer John's N cows (1 ≤ N ≤ 100,000) share many...原创 2018-07-15 21:32:52 · 154 阅读 · 0 评论 -
POJ2229 Sumsets
题目:http://poj.org/problem?id=2229题目大意:就是拆分n 每一位都得是2的幂。 注意4 :1111 112 22 4 一共4种递推:对于n可以分为是奇数还是偶数奇数:肯定有1, 和去掉一个1的情况一样 所以 dp[i] = dp[i-1]偶数:有1的话,肯定有两个1,dp[i] = dp[i-2] 没有1的话,每一位...原创 2018-07-30 08:45:32 · 122 阅读 · 0 评论 -
HDU2050 折线分割平面
题目:acm.hdu.edu.cn/showproblem.php?pid=2050递推:从直线入手,第n条直线,最多和平面上的直线有n-1个交点,多出(n-1)+1个部分序号 1 2 3 ... n 交点 0 1 2 ... n-1 多出部分 1 2 3 ... (n-1)+1 总部...原创 2018-07-27 20:50:55 · 122 阅读 · 0 评论 -
POJ2456 Aggressive cows
题目:http://poj.org/problem?id=2456思路:二分经典题目,二分答案,判断间隔mid是否能容纳所有的奶牛。不过二分坑点比较多例如查找值的时候,while里面写<=, 否则{1,3,5}查找不到5,返回值也是很迷的。这道题返回mid是错误的。可以从结束条件分析,结束条件:l > r, 前一个状态下的 l+1 了,所以最后返回 l-1(纯属个人理解)...原创 2018-08-03 09:29:55 · 285 阅读 · 0 评论 -
POJ2488 A Knight's Journey
题目:http://poj.org/problem?id=2488题目大意:可以从任意点开始,只要能走完棋盘所有点,并要求字典序最小,不可能的话就impossible;思路:dfs+回溯,因为字典序最小,如果可以的话,肯定是从(1,1)开始的。然后递归搜索该点的所有方向,不能满足就回溯,直到找到能满足的,或者一直找不到。代码+注释:#include<iostream>...原创 2018-08-03 09:48:46 · 304 阅读 · 1 评论 -
POJ3278 Catch That Cow
题目:http://poj.org/problem?id=3278 思路:从n到k,每步有3种走法,根本没有发现用bfs可以完美解决问题。方法非常巧。其实也是正常解法,平时做的bfs都是6或8个方向并且是2维的,但是换做3种走法还是一维的就感觉很神奇,说明没有真正理解bfs。这样一说,就更简单了。 AC代码:#include<iostream>#include&...原创 2018-08-03 10:01:45 · 119 阅读 · 0 评论 -
POJ2531 Network Saboteur
题目:http://poj.org/problem?id=2531题目大意:给你N个点,然后以矩阵形式给你了 Cij 的权值, 然后让你把这N个点,分成两部分,使 值最大。思路:显然对于深搜极差的我体验感极差,首先分为 0,1 集合,在1里面就减,在0里面就加,结合代码理解一下dfs(1,0),然后在for里面搜索情况,可以自己模拟一下样例就很清楚了。如果把一个数放入1中,权值变小...原创 2018-08-03 10:35:43 · 129 阅读 · 0 评论 -
POJ2503 Babelfish
题目:http://poj.org/problem?id=2503题目大意:就是后面字符串映射前面字符串,然后查询输出。直接map,不过也可以考虑字典树解决;AC代码:#include<iostream>#include<map>#include<cstdio>#include<string>using namespace st...原创 2018-08-03 10:41:57 · 141 阅读 · 0 评论 -
kuangbin专题十二 POJ1661 Help Jimmy
传送门:http://poj.org/problem?id=1661思路:本来以为是dp二维x, y, 但是不可能开那么大,状态也不好规划。无奈之下看了题解。dp[i][0]表示从左边到达i的最小花费dp[i][1]表示从右边到达i的最小花费然后考虑怎么转移。例: ----------------------------------- ...原创 2018-08-15 19:09:11 · 252 阅读 · 0 评论 -
kuangbin专题十二 POJ3186 Treats for the Cows
传送门:http://poj.org/problem?id=3186题目大意:给一个长度为n的序列,每次只能从队首或队尾取一个数,第几次取 * f[i] 就是利润,求最大利润。看到题目果断贪心,只能局部最优,因为是dp专题,但是丝毫不会dp,看了题解发现是区间dp,然后看着理解了一下,dp[i][j] 表示 从第i个数到第j个数的最大利润,由于只能从dp[i+1][j] 和 dp[i]...原创 2018-08-17 10:48:38 · 138 阅读 · 0 评论 -
POJ2388-Who's in the Middle
题目链接:点击打开链接 Who's in the MiddleTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 45683 Accepted: 26310 DescriptionFJ is surveying his herd to find the most average...原创 2018-07-14 08:28:56 · 126 阅读 · 0 评论 -
POJ1035-Spell checker
题目链接:点击打开链接 Spell checkerTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 27197 Accepted: 9946 DescriptionYou, as a member of a development team for a new s...原创 2018-07-10 15:08:03 · 224 阅读 · 0 评论 -
POJ1611-The Suspects
题目链接:点击打开链接DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to othe...原创 2018-04-14 22:54:12 · 142 阅读 · 0 评论 -
POJ1064-Cable master
题目链接:点击打开链接DescriptionInhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest conte...原创 2018-04-16 16:28:46 · 123 阅读 · 0 评论 -
POJ2524-Ubiquitous Religions
题目链接:点击打开链接DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions stu...原创 2018-04-16 17:27:59 · 110 阅读 · 0 评论 -
POJ1321-棋盘问题
题目链接:点击打开链接Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放...原创 2018-04-25 23:04:53 · 80 阅读 · 0 评论 -
POJ2251-Dungeon Master
题目链接:点击打开链接DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute ...原创 2018-04-26 10:52:40 · 95 阅读 · 0 评论 -
POJ1006 Biorhythms
题目链接:点击打开链接BiorhythmsTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 144625 Accepted: 46587 DescriptionSome people believe that there are three cycles in a pers...原创 2018-05-31 16:23:20 · 172 阅读 · 0 评论 -
POJ3253-Fence Repair
题目链接:点击打开链接Fence RepairTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 59979 Accepted: 19802 DescriptionFarmer John wants to repair a small length of the fence aro...原创 2018-07-18 10:24:38 · 81 阅读 · 0 评论 -
POJ2513-Colored Sticks
题目链接:点击打开链接Colored SticksTime Limit: 5000MS Memory Limit: 128000K Total Submissions: 39392 Accepted: 10271 DescriptionYou are given a bunch of wooden sticks. Each endpoint of...原创 2018-07-18 10:40:55 · 183 阅读 · 0 评论 -
POJ3630-Phone List
题目链接:点击打开链接Phone ListTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 33437 Accepted: 9660 DescriptionGiven a list of phone numbers, determine if it is consistent i...原创 2018-07-18 11:10:20 · 91 阅读 · 0 评论 -
POJ1182 食物链
题目链接:点击打开链接 思路:参考资料后,两种方法:①就是开3倍空间,然后和普通并查集一样,但是关系不太好理解。②向量偏移方法一:有好几种理解方式,还是书上的好理解:x-A x-B x-C y-A y-B y-C AC代码:代码断点1处的 是判断是否b和c不是同类。那么不是同类怎么表示:判断x-A 和 y-B 是不是一组,x-...原创 2018-07-19 08:46:47 · 158 阅读 · 0 评论 -
POJ1836 Alignment
题目链接AlignmentTime Limit: 1000MS Memory Limit: 30000K Total Submissions: 18497 Accepted: 6060 DescriptionIn the army, a platoon is composed by n soldiers. During the morning i...原创 2018-07-25 09:18:43 · 142 阅读 · 0 评论 -
POJ3080-Blue Jeans
题目链接:点击打开链接 Blue JeansTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 20430 Accepted: 9053 DescriptionThe Genographic Project is a research partnership bet...原创 2018-07-13 21:07:52 · 123 阅读 · 0 评论 -
POJ1936-All in All
题目链接:点击打开链接 All in AllTime Limit: 1000MS Memory Limit: 30000K Total Submissions: 35348 Accepted: 14736 DescriptionYou have devised a new encryption technique which encodes ...原创 2018-07-13 21:10:10 · 89 阅读 · 0 评论 -
NYOJ542-试制品
题目链接:点击打开链接 试 制 品时间限制:1000 ms | 内存限制:65535 KB难度:4描述ZZ大学的Dr.Kong最近发现实验室的很多试制品都已经用完。由于项目经费有限,为了节省,Dr.Kong决定利用实验室现有的试制品来生成所缺的试制品。为此,Dr.Kong连续几天通宵达旦整理出一份研究资料并让研究生Bill去实验并统计能产生多少种所缺的试制品。Bil...原创 2018-07-13 21:12:56 · 141 阅读 · 0 评论 -
POJ1664 放苹果 (母函数)
传送门:http://poj.org/problem?id=1664思路:多校见过类似的题目,简单母函数题目,不过比赛的时候,直接给出了解题分析:用的递归写的,感觉不是太理解。递归:(见注释)#include <iostream>#include <stdio.h>#include <math.h>#include <string.h&...原创 2018-08-25 14:26:20 · 509 阅读 · 5 评论