UVA
文章平均质量分 76
_pkm_
love coding
展开
-
uva10285 Longest Run on a Snowboard(dp之记忆化搜索 )
10285 Longest Run on a Snowboard Michael likes snowboarding. That’s not very surprising, since snowboarding is really great. The bad thing is that in order to gain speed, the area must slide downward原创 2015-07-25 12:54:55 · 768 阅读 · 0 评论 -
UVA 253 Cube painting
UVA 253 Cube paintingTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 253 Appoint description:Description Download as PDFWe have a machine for painti原创 2015-07-06 11:45:50 · 598 阅读 · 0 评论 -
uva107 The Cat in the Hat
The Cat in the Hat Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 107 Appoint description:Description Download as PDFBackground(An homage to Theod原创 2015-07-06 12:02:16 · 884 阅读 · 0 评论 -
uva10051(dp 立方体塔, 拆分)
题意:有n个立方体,每一面都有颜色,现在要用他们堆出高度尽量高的塔,条件是,两个接触的块,他们的接触面颜色要一样,同时上面的块重量要严格小于他下面的。 与LIS思想一样,题目给出的数据是按重量递增的#include<iostream>#include<algorithm>#include<map>#include<cstdio>#include<cstdlib>#include<vec原创 2015-07-29 14:58:08 · 488 阅读 · 0 评论 -
UVa 10651 Pebble Solitaire(状态压缩DP)
题意:转化为01序列,可以做如下转换011-->100, 110-->001使得序列的1最少二进制的集合表示:空集:0全集:( 1集合里添加元素:S|(1集合删去元素:S&~(1#include#include#include#include#include#include#include#include#include#include#incl原创 2015-07-29 18:13:15 · 507 阅读 · 0 评论 -
uva 674 Coin Change 经典dp入门
Coin Change Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 674 Appoint description:Description Download as PDFSuppose there are 5 types of coins:原创 2015-07-21 10:43:37 · 666 阅读 · 0 评论 -
uva 116 Unidirectional TSP 单向TSP 问题,经典dP(路径输出注意规划方向)
Unidirectional TSP Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 116 Appoint description:Description Download as PDFBackgroundProblems that requi原创 2015-07-22 15:04:23 · 872 阅读 · 0 评论 -
uva10131 Is Bigger Smarter?(经典DP,最长上升子序列,注意保存路径部分)
Is Bigger Smarter? The ProblemSome people think that the bigger an elephant is, the smarter it is. To disprove this, you want to take the data on a collection of elephants and put as large a subset of原创 2015-07-22 16:14:40 · 809 阅读 · 0 评论 -
uva10003 Cutting Sticks 经典dP,表达式上的动态规划
You have to cut a wood stick into pieces. The most affordable company, The Analog Cutting Machinery, Inc. (ACM), charges money according to the length of the stick being cut. Their procedure of work re原创 2015-07-22 09:10:14 · 929 阅读 · 0 评论 -
uva348Optimal Array Multiplication Sequence (最优矩阵链乘+路径输出)
Optimal Array Multiplication Sequence Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 348 Appoint description:Description Download as PDFGiven two原创 2015-07-24 13:44:20 · 1105 阅读 · 0 评论 -
uva624 CD (01背包+路径的输出)
CD Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 624 Appoint description:Description Download as PDFYou have a long drive by car ahead. You have原创 2015-07-24 13:47:32 · 698 阅读 · 0 评论 -
uva531Compromise (最长公共子序列+路径输出)
Compromise Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 531 Appoint description:Description Download as PDFIn a few months the European Currency原创 2015-07-24 17:14:59 · 637 阅读 · 0 评论 -
uva11044 Searching for Nessy
Searching for Nessy Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 11044 Appoint description:Description Download as PDFThe Loch Ness Monsteris a原创 2015-07-06 12:14:44 · 606 阅读 · 0 评论 -
uva 10499 The Land of Justice
In the Land of Justice the selling price of everything is fixed all over the country. Nobody can buy a thing and sell it in double price. But, that created problems for the businessmen. They left their原创 2015-07-06 12:10:35 · 539 阅读 · 0 评论 -
uva10534(DP之LIS的应用 )
题意:在给出的序列中找到一个长度为奇数的序列,且序列前半段严格单调递增,后半段严格单调递减。 解答:进行两次LIS,一次正向,一次逆向,LIS选用Nlogn的算法/*Solve:*/#include<iostream>#include<algorithm>#include<map>#include<cstdio>#include<cstdlib>#include<vector>#i原创 2015-07-27 21:50:24 · 371 阅读 · 0 评论 -
uva10069(DP+大数)
题意:找出B串在A串出现的次数(B在A中可以是不连续的) 解答:设母串的长度是j,子串的长度数i,在假设dp[i][j]:是在长度是j的母串中出现长度是i的子串的个数,如果A[j]!=B[i],dp[i][j]=dp[i][j-1] 如果A[j]==B[i]; dp[i][j]=dp[i-][j-1]+dp[i][j-1];大数直接用JAVA好了import java.math.BigInte原创 2015-07-27 19:32:37 · 572 阅读 · 0 评论 -
A - Power of Cryptography uva113
A - Power of Cryptography uva113Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 113 Appoint description: Background Current work in cryptography i原创 2015-06-23 16:14:14 · 983 阅读 · 0 评论 -
uva 10719 Quotient Polynomial
10719 Quotient Polynomial A polynomial of degree n can be expressed as p(x) = anxn + an−1xn−1 +···+ a1x + a0 If k is any integer then we can write: p(x) = (x−k)q(x) + r Here q(x) is called the quotie原创 2015-07-06 12:16:02 · 579 阅读 · 0 评论 -
uva 10790 How Many Points of Intersection?
10790 How Many Points of Intersection? We have two rows. There are a dots on the top row and b dots on the bottom row. We draw line segments connecting every dot on the top row with every dot on the b原创 2015-07-06 12:12:36 · 486 阅读 · 0 评论 -
uva846 Steps
Steps Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 846 Appoint description:Description Download as PDFOne steps through integer points of the st原创 2015-07-06 12:09:02 · 676 阅读 · 0 评论 -
Uva10161 Ant on a Chessboard
标题10161 Ant on a Chessboard One day, an ant called Alice came to an M*M chessboard. She wanted to go around all the grids. So she began to walk along the chessboard according to this way: (you can ass原创 2015-06-23 16:29:45 · 693 阅读 · 0 评论 -
UVA 621 Secret Research
Secret Research Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 621 Appoint description:Description Download as PDFAt a certain laboratory results原创 2015-07-06 11:51:17 · 486 阅读 · 0 评论 -
uva10025 The ? 1 ? 2 ? ... ? n = k problem
10025 The ? 1 ? 2 ? … ? n = k problem Given the following formula, one can set operators ‘+’ or ‘-’ instead of each ‘?’, in order to obtain a given k ?1?2?…?n = k For example: to obtain k = 12, the e原创 2015-07-06 11:57:21 · 519 阅读 · 0 评论 -
uva 591 Box of Bricks
Little Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. Look, I've built a wall!'', he tells his older sister Alice.Nah, you should m原创 2015-07-06 11:59:14 · 748 阅读 · 0 评论 -
uva573 The Snail
The Snail Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 573 Appoint description:Description Download as PDFA snail is at the bottom of a 6-foot w原创 2015-07-06 12:07:29 · 514 阅读 · 0 评论 -
uva10404 Bachet’s Game(dp之取石子游戏的胜负)
Bachet’s game is probably known to all but probably not by this name. Initially there are n stones on the table. There are two players Stan and Ollie, who move alternately. Stan always starts. The原创 2015-07-25 15:32:42 · 609 阅读 · 0 评论