- 博客(12)
- 收藏
- 关注
原创 POJ 1191 棋盘分割(DP)
Description将一个8*8的棋盘进行如下分割:将原棋盘割下一块矩形棋盘并使剩下部分也是矩形,再将剩下的部分继续如此分割,这样割了(n-1)次后,连同最后剩下的矩形棋盘共有n块矩形棋盘。(每次切割都只能沿着棋盘格子的边进行) 原棋盘上每一格有一个分值,一块矩形棋盘的总分为其所含各格分值之和。现在需要把棋盘按上述规则分割成n块矩形棋盘,并使各矩形棋盘总分的均方差最小。
2016-11-30 22:54:00 263
原创 POJ 1157 LITTLE SHOP OF FLOWERS(DP)
DescriptionYou want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers, each being of a different kind, and at least as many vases ordered in a row. Th
2016-11-29 23:39:50 217
原创 POJ 1143 Number Game(状压DP)
DescriptionChristine and Matt are playing an exciting game they just invented: the Number Game. The rules of this game are as follows. The players take turns choosing integers greater than 1. Fi
2016-11-29 23:09:12 226
原创 POJ 1018 Communication System(贪心+优化)
题目描述:有n种仪器,第i种仪器有m_i个供应商,不同供应商提供的同一种仪器有不同的带宽(B)和价格(p), n种仪器总带宽为所有仪器带宽最小值。要求从每种仪器的供应商中选一个,使得最终总带宽除以总价格最小。限制:n思路:网上说这是一个DP。如果给出了带宽的范围则可以用DP做,但是题目中并没有给出上界。我的做法是从所有仪器中选出一个,用它的带宽作为所有仪器的瓶颈,然后从带宽更大的仪器中每种
2016-11-29 19:16:09 1057
原创 UVa 908 Re-connecting Computer Sites
Consider the problem of selecting a setT of high-speed lines for connectingN computer sites, from auniverse ofM high-speed lines each connecting a pair of computer sites. Each high-speed line ha
2016-11-24 22:25:42 406
原创 中缀表达式转换为后缀表达式
问题:给出一个表达式,含有括号,将其转化成后缀表达式输出算法:用栈维护将要输出的运算符(operator)读入一个token1)如果是数,直接输出2)如果是运算符(不含括号),比较其与栈顶元素优先级若栈顶元素同级或更高级,则将其出栈并输出,直到栈为空或者栈顶运算符级别更低3)如果是左括号'(', 则将其入栈4)如果是右括号')', 则将栈顶元素依次出栈并输出,直到有匹配
2016-11-23 18:13:52 260
原创 UVa 10810 Ultra-QuickSort(逆序对)
题目描述:给出n个整数,求其逆序对个数。数据范围:n分析:使用归并排序求逆序对/* PROG: UVa10810*/#include #include #include using namespace std;#define MAXN 500010int a[MAXN], b[MAXN], c[MAXN];#define DEBUG 1#define LOG(
2016-11-23 14:32:47 284
原创 UVa 146 ID Codes (next_permutation函数)
It is 2084 and the year of Big Brother has finally arrived, albeit a century late. In order to exercise greater control over its citizens and thereby to counter a chronic breakdown in law and order, t
2016-11-22 14:27:06 211
原创 UVa 11340 Newspaper
News agency pays money for articles according to some rules. Each character has its own value (somecharacters may have value equals to zero). Author gets his payment as a sum of all character’s values
2016-11-22 14:09:07 231
原创 UVa 10392 Factoring Large Numbers(分解因数)
One of the central ideas behind much cryptography is that factoring large numbers is computationallyintensive. In this context one might use a 100 digit number that was a product of two 50 digit prime
2016-11-22 00:15:12 287
原创 UVa 10061 How many zero's and how many digits
Given a decimal integer number you will have to find out how many trailing zeros will be there in itsfactorial in a given number system and also you will have to find how many digits will its factoria
2016-11-21 23:31:49 239
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人