![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
UVA
文章平均质量分 79
小么额菇
Life is about waiting for the right moment to act.
展开
-
UVA - 11809 Floating-Point Numbers
Floating-point numbers are represented differently in computers than integers. That is why a 32-bit floating-point number can represent values in the magnitude of 1038 while a 32-bit integer can only转载 2015-01-28 14:31:08 · 549 阅读 · 1 评论 -
UVA - 140 Bandwidth
UVA - 140BandwidthTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionGiven a graph (V,E) where V is a set of nod原创 2015-03-27 15:00:41 · 420 阅读 · 0 评论 -
UVA - 10118 Free Candies 记忆化搜索
题目链接:UVA - 10118题目是PDF就不贴了,大意就是有四堆糖果,每堆有n个,有个人有个能盛五个糖的篮子,每次可以任选一堆糖,取最上面的那个放到篮子里,如果篮子里有两个颜色相同的,就可以把这两个放到口袋里,篮子满了并且没有相同糖果的时候游戏结束,求他最多能拿到的糖果数。这道题的状态是每堆分别拿num个时,口袋里最多能有多少个糖,dp[num1][num2][num3][num4],也就原创 2015-08-10 10:18:59 · 559 阅读 · 0 评论 -
UVA - 1664 Conquer a New Region
1664 Conquer a New RegionThe wheel of the history rolling forward, our king conquered a new region in a distant continent.There are N towns (numbered from 1 to N) in this region connected by sever原创 2015-07-19 17:11:51 · 508 阅读 · 0 评论 -
UVA - 1252 Twenty Questions 记忆化搜索 状态压缩
DescriptionConsider a closed world and a set of features that are defined for all the objects in the world. Each feature can be answered with ``yes" or ``no". Using those features, we can iden原创 2015-08-14 21:14:16 · 506 阅读 · 0 评论 -
UVA - 1471 Defense Lines 神奇的解法
DescriptionAfter the last war devastated your country, you - as the king of the land of Ardenia - decided it was high time to improve the defense of your capital city. A part of your fortifi原创 2015-07-22 20:36:53 · 1064 阅读 · 0 评论 -
UVA - 10271 Chopsticks DP
UVA - 10271这题的状态是第i根筷子是否参与构成第j双,由于存在第三根筷子,需要加限制条件i>=j*3,然后从大到小排序取。状态方程dp[i][j]=min(dp[i-1][j],dp[i-2][j]+w);#include #include #include #include #include #define INF 0x3f3f3f3fusing namespace原创 2015-08-31 09:24:26 · 452 阅读 · 0 评论 -
UVA - 1220 Party at Hali-Bula 树形DP入门
UVA - 1220 昨天心情不好 因为两道DP题坑了~ 比较奇特的是这题对我来说却相当好理解。。第一次写对状态转移方程。。。难道是因为在树上。。。= = 不知道。好吧 反正就是 树的最大独立集问题,选尽量多的人,但不能同时选一个人和他的上司,想象一下这种结构,如果是有两层的树,要么选根,要么选叶子,对吧,也就是对每个节点(每个人)来说,都有两种决策,选或者不选,如果选这个人,那么所有的叶子都原创 2015-09-01 09:04:35 · 489 阅读 · 0 评论 -
UVA - 12105 Bigger is Better DP
题目链接题意很简单哦,就是用n根火柴拼出能被m整除的最大的数。这题一直困扰了我很久。。。本来是按照书上给的方法,dp[i][j]表示除以m余j的i位数需要的火柴数,刚开始想用记忆化搜索写,然而,在选择数字的时候出了问题,不知道该选大的还是该选火柴少的,恩 一定是功力不够,然后一直拖着好久,今天终于看到了老先生说的‘更简单的做法’,就是用dp[i][j]存储被m除余j的数的最大长度,i为火柴数,原创 2015-09-01 10:50:43 · 505 阅读 · 0 评论 -
UVA - 1336 Fixing the Great Wall 记忆化搜索
题目链接:UVA - 1336最近心情炒鸡差 = = 不过么 也没什么 总会过去的 该做的还是要做的 恩。。教主说的挺对的还是要少看题解多思考。。觉得CF的题目都蛮锻炼脑子的准备刷lrj刷不动的时候做几道那个。这是调了两天调出来的DP。。。说起来也不算很难吧,毕竟书上有解析,大意就是有个机器人在x点,移动速度v,有n个地方需要修补,给出这些点的位置,立即修补的花费c,以及每过一秒(我忘了是原创 2015-08-18 13:56:02 · 613 阅读 · 0 评论 -
UVA - 10559 Blocks 记忆化搜索
依然在DP中挣扎的我。。今天听队友仔细的讲了记忆化搜索与DP的差别 才恍然大悟,01背包之所以可以写成循环的形式,是因为在求解下一状态的最优解时,前面的状态已经解决,但记忆化搜索解决的问题类型,是子问题与总问题有相类似的结构,因此需要层层递归至最底层才能求解。原创 2015-08-21 08:30:49 · 467 阅读 · 0 评论 -
UVA - 1632 Alibaba 区间DP
题目:传送门真是醉了 = =,虽然知道是区间DP,但是这题想了一天都没想出来怎么做,偷偷看了一眼题解的状态定义,又研究了一天,改了好几个小时才做出来。。太弱了。。。状态定义:d[i][j][k]表示区间长度为i,当前位置为j,k=0时表示j是该区间的左端点,k=1时表示j是该区间的右端点,状态转移过程 k==0时,d[i][j][k]可转移到d[i+1][j-1][0]和d[i+1][i+原创 2016-06-12 21:13:07 · 645 阅读 · 0 评论 -
UVA - 1543 Telescope dp+几何
传送门这题的面积每增加一个点,多的面积就是当前点与第一个点和最后一个点构成的三角形面积,可以利用海伦公式计算。我wa了几发,原因是要求精度1e-6,我输出了.7f (= =),然后状态方程,刚开始一直没想到怎么转移,感觉要开一个四维的,分别表示起点,终点,个数,当前点。。。当前点其实并不需要,这一维可以省掉,于是可得到状态方程d[j][l][i] = max(d[j][l][i],d[j][k原创 2016-07-26 10:59:39 · 514 阅读 · 0 评论 -
UVA - 815 Flooded!
Flooded! To enable homebuyers to estimate the cost of flood insurance, a real-estate firm provides clients with the elevation of each 10-meter by 10-meter square of land in regions where h原创 2015-01-28 14:42:15 · 1401 阅读 · 2 评论 -
UVA - 12504 Updating a Dictionary
DescriptionIn this problem, a dictionary is collection of key-value pairs, where keys are lower-case letters, and values are non-negative integers. Given an old dictionary and a new dictionary原创 2015-03-02 08:44:32 · 741 阅读 · 0 评论 -
UVA - 1588 Kickdown
A research laboratory of a world-leading automobile company has received an order to create a special transmission mechanism, which allows for incredibly efficient kickdown -- an operation of switchin原创 2015-01-28 14:18:56 · 629 阅读 · 0 评论 -
UVA - 400 Unix ls
Unix ls The computer company you work for is introducing a brand new computer line and is developing a new Unix-like operating system to be introduced along with the new computer. Your ass原创 2015-01-29 19:48:59 · 773 阅读 · 0 评论 -
UVA - 1587 Box 麻烦
Ivan works at a factory that produces heavy machinery. He has a simple job -- he knocks up wooden boxes of different sizes to pack machinery for delivery to the customers. Each box is a rectangular pa原创 2015-01-29 09:40:02 · 707 阅读 · 0 评论 -
UVA - 201 Squares
这题吧 我觉得我方法很奇葩 看了很多人的代码 没看到跟我一样 用两个结构体的。。。Description Squares A children's board game consists of a square array of dots that contains lines connecting some of the pai原创 2015-02-03 15:56:37 · 527 阅读 · 0 评论 -
UVA - 221 Urban Elevations
Description Urban Elevations An elevation of a collection of buildings is an orthogonal projection of the buildings onto a vertical plane. An external elevation of a city原创 2015-02-09 14:08:52 · 686 阅读 · 0 评论 -
UVA - 1595 Symmetry
DescriptionThe figure shown on the left is left-right symmetric as it is possible to fold the sheet of paper along a vertical line, drawn as a dashed line, and to cut the figure into two ident原创 2015-02-10 17:24:36 · 589 阅读 · 0 评论 -
UVa - 10763 Foreign Exchange
Problem EForeign ExchangeInput: standard inputOutput: standard outputTime Limit: 1 secondYour non-profit organization (iCORE - international Confederation of Revolver Enthusiasts) coordi原创 2015-02-05 18:35:35 · 547 阅读 · 0 评论 -
UVA - 230 Borrowers
DescriptionI mean your borrowers of books - those mutilators of collections, spoilers of the symmetry of shelves, and creators of odd volumes.- (Charles Lamb, Essays of Elia (1823) `The Tw原创 2015-02-12 11:25:52 · 1922 阅读 · 0 评论 -
UVA - 202 Repeating Decimals
Repeating Decimals The decimal expansion of the fraction 1/33 is , where the is used to indicate that the cycle 03 repeats indefinitely with no intervening digits. In fact, the decimal转载 2015-02-12 17:59:09 · 412 阅读 · 0 评论 -
UVA - 122 Trees on the level
DescriptionBackgroundTrees 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- a原创 2015-03-01 10:10:11 · 457 阅读 · 0 评论 -
UVA - 548 Tree
DescriptionYou are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value of原创 2015-03-01 10:14:41 · 435 阅读 · 0 评论 -
UVA - 1103 Ancient Messages(三组数据)
DescriptionIn order to understand early civilizations, archaeologists often study texts written in ancient languages. One such language, used in Egypt more than 3000 years ago, is based on cha原创 2015-03-01 09:59:33 · 866 阅读 · 0 评论 -
UVA - 10723 Cyborg Genes DP:最长公共子序列扩展
传送门题意:输入两个串,找一个最短的串使两个串都是它的子序列(可以不连续),求最短的长度和解的个数。观察可知最短长度就是两串长度之和减去最长公共子序列的长度。一开始还想求出这个长度来之后暴个数。。真是太愚蠢了= =,分析一下,当s1[i]==s2[j]的时候,个数一定和c[i-1][j-1]的个数一样,就是加上当前的字母;如果不相等,那么分三种情况,d[i-1][j]>d[i][j-1],原创 2016-07-04 18:46:40 · 469 阅读 · 0 评论