码迷,mamicode.com
首页 >  
搜索关键字:dp    ( 24588个结果
Codeforces 453B Little Pony and Harmony Chest(状压)
题目链接:Codeforces 453B Little Pony and Harmony Chest 题目大意:给定一个序列a, 求一序列b,要求∑|ai?bi|最小。并且b中任意两数的最大公约束为1. 解题思路:因为b中不可能含有相同的因子,所以每个素数只能使用1次。又因为说ai最大为30,所以素数只需要考虑到57即可。因为即使对于30而言,59和1的代价是一样的。 所以有dp[i...
分类:其他好文   时间:2014-08-02 23:28:44    阅读次数:312
xtu DP Training C.炮兵阵地
炮兵阵地Time Limit: 2000msMemory Limit: 65536KBThis problem will be judged onPKU. Original ID:118564-bit integer IO format:%lld Java class name:Main司令部的将军...
分类:其他好文   时间:2014-08-02 23:23:05    阅读次数:302
latex Test
分类:其他好文   时间:2014-08-02 23:05:44    阅读次数:179
LightOJ 1205 - Palindromic Numbers (数位dp)
LightOJ 1205 - Palindromic Numbers (数位dp) ACM 题目地址:SPOJ MYQ10 Mirror Number 题意:  求[a,b]中回文的个数。 分析:  是SPOJ MYQ01的简单版...其实有非递归方法的。 代码: /* * Author: illuz * Blog: http:...
分类:其他好文   时间:2014-08-02 20:56:24    阅读次数:218
xtu DP Training B. Collecting Bugs
B. Collecting BugsTime Limit: 10000msMemory Limit: 64000KB64-bit integer IO format:%lld Java class name:MainSpecial JudgeIvan is fond of collecting. U...
分类:其他好文   时间:2014-08-02 20:36:46    阅读次数:258
SPOJ MYQ10 10649. Mirror Number (数位dp)
SPOJ MYQ10 10649. Mirror Number (数位dp) ACM 题目地址:SPOJ MYQ10 Mirror Number 题意:  求[a,b]中镜像回文的个数。  0 分析:  看到题目和数据范围就知道是数位dp了。  很明显镜像回文只有0,1,8,跟回文的一题一样,在dfs的时候得开个辅助数组记录前面已经选择的数字。  注意还得去掉前...
分类:其他好文   时间:2014-08-02 18:27:13    阅读次数:242
ZOJ Monthly, September 2003【部分题解】
今天比赛做了一下这套题目。出了四道。两道水题,两道DP...
分类:其他好文   时间:2014-08-02 18:23:04    阅读次数:336
Codeforces 453B Little Pony and Harmony Chest 状压dp
题目链接:点击打开链接 b的数字最多只能达到59,因为选>=60 不如选1 所以状压一下前面出现过的素数即可,在59内的素数很少 然后暴力转移。。 #include #include #include #include #include const int Inf = (int)(1e9); const int S = 1 << 17; const int N = 100 + 2...
分类:其他好文   时间:2014-08-02 18:20:53    阅读次数:225
ZOJ 1642 Match for Bonus(dp)
Match for Bonus Time Limit: 2 Seconds      Memory Limit: 65536 KB Roy played a game with his roommates the other day.  His roommates wrote 2 strings of characters, and gave each character a b...
分类:其他好文   时间:2014-08-02 18:20:33    阅读次数:256
codeforces2B - The least round way DP
题意:给你一个矩阵,问你从左上角走一直走到右下角只能向右向下,问你最后乘起来尾数0个数最少的数值和路径是什么解题思路:可以知道 要么这条路径上和 的质因子 2 的个数 7 #include 8 #include 9 #include 10 #include 11 #include 12 #i...
分类:其他好文   时间:2014-08-02 18:16:43    阅读次数:248
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!