poj 1079 Calendar Game(博弈论 SG)...
分类:
其他好文 时间:
2014-06-22 21:52:49
阅读次数:
162
dp题:
1、写状态转移方程;
2、考虑初始化边界,有意义的赋定值,还没计算的赋边界值;
3、怎么写代码自底向上计算最优值
今天做了几个基础dp,全部是dp方程写对但是初始化以及计算写错
先是poj 1651 其实就是个赤裸裸的矩阵连乘,dp方程很容易写出
dp[i][j]=min(dp[i][k]+dp[k+1][j]+r[i]*c[k]*...
分类:
其他好文 时间:
2014-06-22 19:29:41
阅读次数:
157
题目链接:POJ 1573 Robot Motion
一个小模拟,很简单,按照提示一步步走就是了
#include
#include
#include
#include
#include
using namespace std;
int n = 0,m = 0,st = 0;
int map[10][20],dis[10][20];;...
分类:
其他好文 时间:
2014-06-22 18:14:23
阅读次数:
182
Description
The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other names) i...
分类:
其他好文 时间:
2014-06-22 17:15:11
阅读次数:
275
题目大意:
T组测试数据,求(A1B1+A2B2+ ... +AHBH)mod M.
解题思路:
对于普通暴力算法一定是
A1*A1*A1.....*A1 乘以 B1次,
A2*A2...........*A2 乘以 B2次,
......................................
然后全部相加起来,这样效率很低,肯定是超时了
那么有什么办法解决这一问题,可以用快速幂,
如果 A1^2有了,那么 A1^4就可以得到,A1^8也可以得到,...... ,立刻由n降到了lgn
可以...
分类:
其他好文 时间:
2014-06-22 16:17:10
阅读次数:
178
poj 1007 Quoit Design(分治)...
分类:
其他好文 时间:
2014-06-22 15:56:34
阅读次数:
137
Description
Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways:
q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses...
分类:
其他好文 时间:
2014-06-22 14:06:49
阅读次数:
249
因为苹果可能在不同的子树中,所以,很容易想到设状态dp_back[i][j]为以i点为树根走j步并回到i点的最大苹果数与dp_to[i][j]不回到i点的两个状态。于是,转移方程就很明显了。只是注意要减去一来一回,或者不回的边。树形DP里套背包。但这题远比这复杂,个人认为。因为在实现上细节太多。实现...
分类:
其他好文 时间:
2014-06-22 13:14:18
阅读次数:
201
Help Me with the Game
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 3210
Accepted: 2071
Description
Your task is to read a picture of a chessboard position...
分类:
其他好文 时间:
2014-06-22 00:22:45
阅读次数:
382
BUY LOW, BUY LOWER
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 8311
Accepted: 2883
Description
The advice to "buy low" is half the formula to success i...
分类:
其他好文 时间:
2014-06-21 20:49:18
阅读次数:
304