// poj2955 简单区间dp
// d[i][j]表示i到j区间所能形成的最大匹配序列
// dp[i][j] = max(dp[i][k]+dp[k+1][j]){i<k<j}
// dp[i][j] = max(dp[i+1][j-1]+2) if (s[i] match s[j])
//
// 记忆化搜索的时候,将dp[i][i] = 0 ,其他赋值成-1;
//
// 做题的时候刚开...
分类:
其他好文 时间:
2015-05-09 19:08:13
阅读次数:
118
题目大意:每一小格代表能向右或者向下走几步,问从左上走到右下总共有多少种走法。
dp[i][j]存放该格子有多少总走法。
#include
#include
using namespace std;
int n;
char a[40][40];
int s[40][40];
__int64 dp[40][40];
int X[]={1, 0...
分类:
其他好文 时间:
2015-05-09 15:06:55
阅读次数:
198
题意:
第一行 案例数。 然后每个案例用空行隔开。
每个案例都有若干行 ,第一个单词表示一个软件,如果名字后面有*号,代表安装这个软件需要重启。 多个软件可以同时 一次重启 安装。然后冒号后面 表示安装这个软件需要先安装的软件。
做法:
有两种做法,不过都需要先建图。用get函数来把字符串变成编号。 id 表示冒号前的软件,fu表示冒号后面的软件。要把 id 存入 vector son[fu], 就像树一样存。然后把 id的入度++;
第一种做法,拓扑排序。把入度为0的 且不需要重启的 存入q1队列...
分类:
编程语言 时间:
2015-05-07 22:04:46
阅读次数:
166
UVA - 12063
Zeros and Ones
Time Limit: 3000MS
Memory Limit: Unknown
64bit IO Format: %lld & %llu
Submit Status
Description
Binary numbers and their pattern o...
分类:
其他好文 时间:
2015-05-07 06:30:27
阅读次数:
220
uva 10626 Buying CokeI often buy Coca-Cola from the vending machine at work. Usually I buy several cokes at once, since my working mates also likes coke. A coke in the vending machine costs 8 Swedish c...
分类:
其他好文 时间:
2015-05-06 17:55:34
阅读次数:
141
Farmer John has just given the cows a program to play with! The program contains two integer variables, x and y, and performs the following operations on a sequence a1,?a2,?…,?an of positive integers:I...
分类:
其他好文 时间:
2015-05-06 17:55:05
阅读次数:
187
//枚举有几个(7或4),用数位dp的记忆化搜索找有i个(7或4)的数又多少个
//暴力搜索在第i个中选几个
#include
#include
#include
using namespace std ;
const int mod = 1e9 + 7;
int dp[20][20];//第i位有 j个数(7或者4)
int bit[20] ;
int temp[20];
i...
分类:
其他好文 时间:
2015-05-05 21:57:40
阅读次数:
114
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define INF 100000000
using namespace std;
int v[][2] = {{1,0},{0,1},{-1,0},{0,-1}};
int...
分类:
其他好文 时间:
2015-05-04 22:06:15
阅读次数:
92
A Walk Through the ForestTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 6397 Accepted Submission(s): 2348Problem Description
Jimmy experie...
分类:
其他好文 时间:
2015-05-03 00:52:15
阅读次数:
163
Codeforces Div.301D Bad Luck Island(概率dp+记忆化搜索)
分类:
其他好文 时间:
2015-05-02 23:17:07
阅读次数:
239