hdu 2151 Worm (DP)】的更多相关文章

Worm Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2637    Accepted Submission(s): 1707 Problem Description 自从见识了平安夜苹果的涨价后,Lele就在他家门口水平种了一排苹果树,共有N棵. 突然Lele发现在左起第P棵树上(从1开始计数)有一条毛毛虫.为了看到毛毛虫变蝴蝶的过…
Worm Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3895 Accepted Submission(s): 2518 Problem Description 自从见识了平安夜苹果的涨价后,Lele就在他家门口水平种了一排苹果树,共有N棵. 突然Lele发现在左起第P棵树上(从1开始计数)有一条毛毛虫.为了看到毛毛虫变蝴蝶的过程,Lel…
http://acm.hdu.edu.cn/showproblem.php?pid=2151 Worm Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3403    Accepted Submission(s): 2194 Problem Description 自从见识了平安夜苹果的涨价后,Lele就在他家门口水平种了一排苹果树,共有…
http://acm.hdu.edu.cn/showproblem.php? pid=4123 Problem Description Bob wants to hold a race to encourage people to do sports. He has got trouble in choosing the route. There are N houses and N - 1 roads in his village. Each road connects two houses,…
http://acm.hdu.edu.cn/showproblem.php?pid=4507 Problem Description 单身! 依旧单身! 吉哥依旧单身! DS级码农吉哥依旧单身! 所以.他生平最恨情人节,无论是214还是77.他都讨厌! 吉哥观察了214和77这两个数,发现: 2+1+4=7 7+7=7*2 77=7*11 终于,他发现原来这一切归根究竟都是由于和7有关!所以,他如今甚至讨厌一切和7有关的数. 什么样的数和7有关呢? 假设一个整数符合以下3个条件之中的一个.那么我…
http://acm.hdu.edu.cn/showproblem.php?pid=3709 Problem Description A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight indicated by the digit.…
XHXJ's LIS Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2265    Accepted Submission(s): 927 Problem Description #define xhxj (Xin Hang senior sister(学姐)) If you do not know xhxj, then careful…
You Are the One Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3348    Accepted Submission(s): 1524 Problem Description The TV shows such as You Are the One has been very popular. In order to m…
HDU 2829 区间DP & 前缀和优化 & 四边形不等式优化 n个节点n-1条线性边,炸掉M条边也就是分为m+1个区间 问你各个区间的总策略值最少的炸法 就题目本身而言,中规中矩的区间DP问题 d p[i][j]表示前i个节点,分为j个区间的最优策略值 cost[i][j]为从i到j节点的策略值 所以dp[i][j] = min(dp[k-1][j-1] + cost[k][i] 但是复杂度太高了 可以优化的地方有: cost数组值得求取: 考虑到cost(i,j)=ΣAxAy (i≤…
HDOJ(HDU).2844 Coins (DP 多重背包+二进制优化) 题意分析 先把每种硬币按照二进制拆分好,然后做01背包即可.需要注意的是本题只需要求解可以凑出几种金钱的价格,而不需要输出种数.因此用0表示不可以,1表示可以.最后对dp数组扫描一遍即可. 代码总览 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define nmax 100…