![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
hdu/poj
文章平均质量分 69
儒rs
小小的天有大大的梦想,我有属于我的天。
展开
-
hdu-1503 Advanced Fruits(LCS)
Advanced FruitsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6597 Accepted Submission(s): 3459Special JudgeProblem DescriptionThe company “21st Century Fruits” has specialized in creating ne原创 2021-03-20 15:16:39 · 151 阅读 · 0 评论 -
poj-1080 Human Gene Functions(LCS)
Human Gene Functions题目描述题意给出两个基因字符串a,b,每一种匹配都有一个值,可以在串中添加‘-’,改变匹配的顺序,最后求全部匹配的最大值。分析思路:先将字符串转化,每个字符分别用0,1,2,3,表示‘-’用4表示状态:d[i][j]表示串a前i个和串b前j个匹配的最大值转移方程:d[i][j] = max( d[i-1][j-1]+c[a[i]][b[j]], d[i-1][j]+c[a[i]][4], d[i][j-1]+c[4][b[j]] );1、a取第i个字原创 2021-03-20 15:09:18 · 176 阅读 · 0 评论 -
poj-2250 Compromise(LCS)
CompromiseTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10548 Accepted: 4499 Special JudgeDescriptionIn a few months the European Currency Union will become a reality. However, to join the club, the Maastricht criteria must be fulfilled,原创 2021-03-20 14:45:23 · 144 阅读 · 0 评论 -
hdu-1003 Max Sum
Max SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 368034 Accepted Submission(s): 88083Problem DescriptionGiven a sequence a[1],a[2],a[3]…a[n], your job is to calculate the max sum of a sub原创 2021-03-14 09:00:12 · 75 阅读 · 0 评论 -
hdu-1087 Super Jumping!
Super Jumping! Jumping! Jumping!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 68578 Accepted Submission(s): 32143Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumpi原创 2021-03-14 08:56:15 · 65 阅读 · 0 评论 -
hdu-2159 FATE(完全背包)
FATETime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 25974 Accepted Submission(s): 11989Problem Description最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,x原创 2021-03-13 15:04:29 · 129 阅读 · 0 评论 -
hdu-2955 Robberies(0/1背包)
RobberiesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 40737 Accepted Submission(s): 14511Problem DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the原创 2021-03-11 21:22:21 · 125 阅读 · 0 评论 -
hdu-1864 最大报销额(0/1背包)
最大报销额Problem Description现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。Input测试输入包含若干测试用例。每个测试用例的第1行包含两个正数 Q 和 N,其中 Q 是给定的报销额度,N(<=30)是发票张数。随后是 N 行输入,每行的格式为:m Type_1原创 2021-03-11 16:41:53 · 165 阅读 · 0 评论 -
hdu-2044 一只小蜜蜂...(递推)
一只小蜜蜂…Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 139206 Accepted Submission(s): 48825Problem Description有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数。其中,蜂房的结构如下所示。Input输入数据的第一行是一原创 2021-03-10 15:38:44 · 242 阅读 · 0 评论 -
hdu-2041 超级楼梯(递推)
超级楼梯Problem Description有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法?Input输入数据首先包含一个整数N,表示测试实例的个数,然后是N行数据,每行包含一个整数M(1<=M<=40),表示楼梯的级数。Output对于每个测试实例,请输出不同走法的数量Sample Input223Sample Output12代码#include<iostream>#include<cmath原创 2021-03-10 15:32:27 · 124 阅读 · 0 评论 -
hdu2050 母牛的故事(递推)
母牛的故事Problem Description有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?Input输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0<n<55),n的含义如题目中描述。n=0表示输入数据的结束,不做处理。Output对于每个测试实例,输出在第n年的时候母牛的数量。每个输出占一行。Sample Input2450Sample Output24原创 2021-03-10 15:25:27 · 97 阅读 · 0 评论 -
hdu-2050 折线分割平面 (递推)
折线分割平面Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 53339 Accepted Submission(s): 34919Problem Description我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分原创 2021-03-10 15:17:52 · 141 阅读 · 0 评论 -
hdu-1257 最少拦截系统(LIS)
最少拦截系统Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统.Input输入若干组数据.每组数据包括:导弹总个数(正原创 2021-03-09 21:06:25 · 538 阅读 · 0 评论 -
hdu-4576 Robot(DP+滚动数组)
Problem DescriptionMichael has a telecontrol robot. One day he put the robot on a loop with n cells. The cells are numbered from 1 to n clockwise.At first the robot is in cell 1. Then Michael uses a remote control to send m commands to the robot. A comm原创 2021-02-25 11:09:58 · 152 阅读 · 0 评论 -
hdu-2602 Bone Collector(DP 0/1背包问题)
Bone CollectorProblem 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 …The bone collector had a big bag with a原创 2021-02-24 17:19:16 · 464 阅读 · 0 评论 -
hdu-1024 Max Sum Plus Plus(DP+滚动数组)
1.题目题目链接。题意大概就是,把一个数组分成m段, 有式子 sum(i1, j1) + sum(i2, j2) + sum(i3, j3) + … + sum(im, jm),求使得上述和最大,ik,jk是连续的jk和ik+1可以不连续。2.分析这是动态规划的题目,假设状态d[i][j]表示在选取第j个数字的情况下,将前j个数字分成i组的最大和。则它的值有两种可能①(x1,y1),(x2,y2)…(xi,yi,num[j])②(x1,y1),(x2,y2)…(xi-1,yi-1),…,(num原创 2021-02-24 16:00:10 · 116 阅读 · 0 评论 -
最大子段和(基础DP)
最大子段和是一个学习动态规划必学的问题,也是最基础的动态规划问题。例题洛谷1115 最大子段和题目描述:给出一段序列,选出其中连续且非空的一段使得这段和最大。输入格式:第一行:是一个正整数N,表示了序列的长度。第二行:包含N个整数num[i],描述了这段序列。输出格式:一个整数,为最大的子段和是多少。输入样例:72 -4 3 -1 2 -4 312输出样例:41最大子段和对于最大子段和这个问题,其实我们发现如果说序列中所有的数都是正数,那么最大子段和一定是所有数的和转载 2021-02-24 11:10:35 · 375 阅读 · 0 评论 -
hdu-2069 Coin Change(基础DP)
Coin ChangeTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 31856 Accepted Submission(s): 11437Problem DescriptionSuppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cen原创 2021-02-22 10:49:01 · 156 阅读 · 0 评论 -
hdu-4864 Task(贪心好题)
TaskTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 16739 Accepted Submission(s): 4259Problem DescriptionToday the company has m tasks to complete. The ith task need xi minutes to complete. Mea原创 2021-02-15 16:13:55 · 241 阅读 · 0 评论 -
hdu-3348 coins(贪心法)
coinsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3592 Accepted Submission(s): 1300Problem Description“Yakexi, this is the best age!” Dong MW works hard and get high pay, he has many 1 Jiao原创 2021-02-15 15:59:30 · 267 阅读 · 0 评论 -
hdu-1050 Moving Tables(贪心法)
Moving TablesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 52571 Accepted Submission(s): 17125Problem DescriptionThe famous ACM (Advanced Computer Maker) Company has rented a floor of a build原创 2021-02-15 15:43:55 · 305 阅读 · 0 评论 -
hdu-1789 Doing Homework again(贪心)
Doing Homework againTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24503 Accepted Submission(s): 14083Problem DescriptionIgnatius has just come back school from the 30th ACM/ICPC. Now he has a原创 2021-02-15 15:21:08 · 112 阅读 · 0 评论 -
poj-2388 快速排序
Who’s in the MiddleTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 54415 Accepted: 31438DescriptionFJ is surveying his herd to find the most average cow. He wants to know how much milk this ‘median’ cow gives: half of the cows give as much原创 2021-02-15 09:32:59 · 235 阅读 · 0 评论 -
hdu-4911 Inversion(归并排序)
InversionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 9690 Accepted Submission(s): 3422Problem Descriptionbobo has a sequence a1,a2,…,an. He is allowed to swap two adjacent numbers for no原创 2021-02-14 17:08:08 · 281 阅读 · 0 评论 -
hdu-2899 Strange fuction(模拟退火)
Strange fuctionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15738 Accepted Submission(s): 10341Problem DescriptionNow, here is a fuction:F(x) = 6 * x7+8*x6+7x3+5*x2-yx (0 <= x <=100)原创 2021-02-12 14:33:16 · 139 阅读 · 0 评论 -
poj-1521 Entropy(哈夫曼 贪心)
Entropypoj1521题意题目描述较长,其实意思就是输入一个字符串,分别用普通ASCII编码(每个字符8bit)和Huffman编码,输出编码后的长度,并输出压缩比。代码#include<iostream>#include<queue>#include<string>#include<cstdio>#include<algorithm>using namespace std;int main(){ string s;原创 2021-02-12 14:27:28 · 479 阅读 · 0 评论 -
hdu-2570 迷瘴(贪心水题)
迷瘴Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 19817 Accepted Submission(s): 6373Problem Description通过悬崖的yifenfei,又面临着幽谷的考验——幽谷周围瘴气弥漫,静的可怕,隐约可见地上堆满了骷髅。由于此处长年不见天日,导致空气中布满了毒素,一旦吸入体内,便会全身溃烂而死。原创 2021-02-12 14:21:39 · 182 阅读 · 0 评论 -
hdu-2037 今年暑假不AC(贪心 活动安排问题)
今年暑假不ACTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 109489 Accepted Submission(s): 58313Problem Description“今年暑假不AC?”“是的。”“那你干什么呢?”“看世界杯呀,笨蛋!”“@#$%^&*%…”确实如此,世界杯来了,球迷的节日也来了,估计很多ACMe原创 2021-02-12 14:17:36 · 100 阅读 · 0 评论 -
hdu-3791 二叉搜索树
二叉搜索树Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10109 Accepted Submission(s): 4434Problem Description判断两序列是否为同一二叉搜索树序列Input开始一个数n,(1<=n<=20) 表示有n个需要判断,n= 0 的时候输入结束。接下去一行是一个序列,序列长度原创 2021-02-10 10:22:18 · 200 阅读 · 0 评论 -
poj-2418 Hardwood Species(用map处理字符串)
题目链接poj2418题意题意:美国有各种各样不同的树木,你需要输入树木的名字,并且最后统计出每种树木所占的比例,并按字典序输出。代码#include<iostream>#include<map>#include<string>#include<iomanip>#include<cstdio>using namespace std;int main(){ //freopen("data.txt","r",stdin);原创 2021-02-10 10:06:54 · 101 阅读 · 0 评论 -
hdu-1710 Binary Tree Traversals
Binary Tree TraversalsTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18404 Accepted Submission(s): 7619Problem DescriptionA binary tree is a finite set of vertices that is either empty or cons原创 2021-02-09 10:30:21 · 82 阅读 · 0 评论 -
hdu-1272 小希的迷宫(并查集)
小希的迷宫Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 83971 Accepted Submission(s): 26426Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的原创 2021-02-07 14:11:38 · 113 阅读 · 0 评论 -
hdu-3635 Dragon Balls(并查集)
Dragon BallsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11845 Accepted Submission(s): 4137Problem DescriptionFive hundred years later, the number of dragon balls will increase unexpectedly,原创 2021-02-06 10:13:32 · 176 阅读 · 0 评论 -
poj-1611 The Suspects(并查集简单题)
The SuspectsTime Limit: 1000MS Memory Limit: 20000KTotal Submissions: 67614 Accepted: 31979DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimi原创 2021-02-06 10:05:18 · 144 阅读 · 0 评论 -
hdu-1213 How Many Tables(并查集)
How Many TablesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 67842 Accepted Submission(s): 34247Problem DescriptionToday is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner ti原创 2021-02-06 09:08:26 · 119 阅读 · 0 评论 -
poj-1182 食物链(并查集经典题)
食物链Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 124632 Accepted: 38129Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是同类。第二种说法是"2原创 2021-02-05 17:20:23 · 385 阅读 · 0 评论 -
hdu-5113 Black And White(DFS)
Black And WhiteTime Limit: 2000/2000 MS (Java/Others)Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 7780 Accepted Submission(s): 2131Special JudgeProblem DescriptionIn mathematics, the four color theorem, or the four color map the原创 2021-02-03 15:17:06 · 253 阅读 · 0 评论 -
hdu-1175 连连看(DFS)
连连看Time Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 53207 Accepted Submission(s): 13537Problem Description“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且原创 2021-02-03 15:01:18 · 253 阅读 · 0 评论 -
poj-2676 Sudoku(DFS)
SudokuTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 30704 Accepted: 13960 Special JudgeDescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some原创 2021-02-02 15:28:40 · 200 阅读 · 0 评论 -
poj-2531 Network Saboteur(DFS)
Network SaboteurTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 17238 Accepted: 8677DescriptionA university network is composed of N computers. System administrators gathered information on the traffic between nodes, and carefully divided t原创 2021-02-02 15:13:15 · 157 阅读 · 1 评论