hdu和poj的基础dp30道】的更多相关文章

题目转自:https://crazyac.wordpress.com/dp%E4%B8%93%E8%BE%91/ 1.hdu 1864 最大报销额 唔,用网上的算法连自己的数据都没过,hdu的数据居然就过了..垃圾数据.. 比如这个:100.00 3 1 A:1000.00 1 A:200.50 1 A:100.00 输出应该是100.00,然而网上的算法输出是200.50..hdu的discuss区也是一片骂声..看到有人说测试数据都是两位小数的(但题目没说),那就每个数据都乘100然后用01…
Coins HDU - 2844 POJ - 1742 多重背包可行性 当做一般多重背包,二进制优化 #include<cstdio> #include<cstring> int n,m,anss; ],c[],f[]; int main() { int i,j,t; scanf("%d%d",&n,&m); ||m!=) { anss=; memset(f,,sizeof(f)); ;i<=n;i++) scanf("%d&qu…
Description The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, each with a number from 1 to 15 on it, and all packed into a 4 by 4 frame with one tile mis…
Description Aliens on planet Pandora also write computer programs like us. Their programs only consist of capital letters (‘A’ to ‘Z’) which they learned from the Earth. On planet Pandora, hackers make computer virus, so they also have anti-virus sof…
hdu 2844 poj 1742 Coins 题目相同,但是时限不同,原本上面的多重背包我初始化为0,f[0] = 1;用位或进行优化,f[i]=1表示可以兑成i,0表示不能. 在poj上运行时间正好为时限3000ms....太慢了,hdu直接TLE(时限1s); 之 后发现其实并不是算法的问题,而是库函数的效率没有关注到.我是使用fill()按量初始化的,但是由于memset()可能是系统底层使用了四个字节拷 贝的函数(远比循环初始化快),效率要高得多..这就是为什么一直TLE的原因,fil…
Description Ted has a new house with a huge window. In this big summer, Ted decides to decorate the window with some posters to prevent the glare outside. All things that Ted can find are rectangle posters. However, Ted is such a picky guy that in ev…
Description Too worrying about the house price bubble, poor Mike sold his house and rent an apartment in a 50-floor building several months ago. This building has only one elevator because it is a so called “rotten tail building”. There are always a…
学习链接:http://blog.csdn.net/lwt36/article/details/48908031 学习扫描线主要学习的是一种扫描的思想,后期可以求解很多问题. 扫描线求矩形周长并 hdu 1928 Picture Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4795    Accepted Submission(s):…
Tunnel Warfare                                                             Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)                                                                                            …
树链剖分是一个很固定的套路 一般用来解决树上两点之间的路径更改与查询 思想是将一棵树分成不想交的几条链 并且由于dfs的顺序性 给每条链上的点或边标的号必定是连着的 那么每两个点之间的路径都可以拆成几条链 那么就是对一群区间进行更改 这时候基本是用线段树进行logn的操作 做了三道基础题 都属于比较好想的 也就是线段树比较麻烦 需要写相当长一段时间... HDU 3966 给出一棵树的连接状况和边的大小 每次可以对a-b的路径的边的权值取反 或者改变指定边的值 或者求a-b路径的最大值 每次取反…