1:POJ炮兵阵地 预先处理好情况,然后又类似格子取数的状压。我们用DP[I][J][K]表示处理第I个格子,I-1格子的状态为J,I-2的格子为K,然后转移1#include2#include3#include4#include5#include6usingnamespacestd;7chars[...
分类:
其他好文 时间:
2014-07-26 09:52:27
阅读次数:
254
Painting Storages
Time Limit: 2 Seconds Memory Limit: 65536 KB
There is a straight highway with N storages alongside it labeled by 1,2,3,...,N. Bob asks you to paint all storages with two...
分类:
其他好文 时间:
2014-07-26 02:48:17
阅读次数:
178
注意数组的大小,以及字符的输入问题
#include
#include
int dp[4000000],a[4],money[400];
char s[120];
double str[120];
int max(int a,int b)
{return a>b?a:b;}
int main()
{
int N,sum,ans,ok,count,i,j,num;
double Q...
分类:
其他好文 时间:
2014-07-26 02:38:26
阅读次数:
253
public class PxAndDp {
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
...
分类:
移动开发 时间:
2014-07-26 02:36:36
阅读次数:
276
Description
单身!
依然单身!
吉哥依然单身!
DS级码农吉哥依然单身!
所以,他生平最恨情人节,不管是214还是77,他都讨厌!
吉哥观察了214和77这两个数,发现:
2+1+4=7
7+7=7*2
77=7*11
最终,他发现原来这一切归根到底都是因为和7有关!所以,他现在甚至讨厌一切和7有关的数!...
分类:
其他好文 时间:
2014-07-26 02:30:26
阅读次数:
274
#include
#include
#include
int s[1050];
int dp[1050];
int cmp(const void *a,const void * b)
{
return *(int *)b-*(int *)a;
}
int maxx(int a,int b)
{return a>b?a:b;}
int main()
{
int n,i,j,sum,MA...
分类:
其他好文 时间:
2014-07-26 02:20:36
阅读次数:
193
题目:hdu 4003 Find Metal Mineral
题意:火星上发现了一些n个矿厂,有 k 个机器人从 s 点出发采矿,给出路段间的花费cost,求最小的花费采所有的矿。
分类:树形dp + 分组背包
分析:结论1:假如我们从 i点出发k个机器人采完以 k 为根节点的所有矿又回到 i 点,那么花费为 i 为根节点的cost 的和 乘以 k。
对于每个节点...
分类:
其他好文 时间:
2014-07-26 02:15:36
阅读次数:
209
求最大价值:要求恰好装满背包,那么在初始化时除了dp[0]为0其它dp[1..V]均设为-∞
求最小价值:要求恰好装满背包,那么在初始化时除了dp[0]为0其它dp[1..V]均设为∞
代码如下:
注意下标问题
#include
int p[1008],w[1008];
int dp[10000];
int min(int a,int b)
{ret...
分类:
其他好文 时间:
2014-07-26 02:00:06
阅读次数:
169