题目链接:点击打开链接
编辑距离,,== 一边dp一边记录前驱太累,,还是dp后找路径大法好
#include
#include
#include
#include
using namespace std;
#define ll int
#define N 1010
char s[N], t[N];
int dp[N][N], n, m;
// 0为插入 1为删除 2 3为替换
struct ...
分类:
其他好文 时间:
2014-08-04 17:49:47
阅读次数:
275
题目链接:点击打开链接
先是计算非递增的方案,
若非递增的方案数为x, 则非递减的方案数也是x
答案就是 2*x - n
只需求得x即可。
可以先写个n3的dp,然后发现规律是 C(n-1, 2*n-1)
然后套个逆元即可。
#include
#include
#include
#include
using namespace std;
#define ll long long
#d...
分类:
其他好文 时间:
2014-08-04 17:42:48
阅读次数:
228
题目链接;uva 12253 - Simple Encryption
题目大意:给定K1,求一个12位的K2,使得KK21=K2%1012
解题思路:按位枚举,不且借用用快速幂取模判断结果。
#include
#include
#include
using namespace std;
typedef long long ll;
const ll ite=(120)-1;
...
分类:
其他好文 时间:
2014-08-04 11:02:57
阅读次数:
194
Prime Testhttp://poj.org/problem?id=1811 1 #include 2 #include 3 using namespace std; 4 typedef __int64 LL; 5 LL mulmod(LL a,LL b,LL c) { //ret=(...
分类:
其他好文 时间:
2014-08-03 20:18:15
阅读次数:
245
Raising Modulo Numbershttp://poj.org/problem?id=1995快速幂取模 1 #include 2 typedef __int64 LL; 3 LL quickpow(LL a,LL b,LL c){//快速幂求(a^b)%c 4 LL ret=1%...
分类:
其他好文 时间:
2014-08-03 17:50:35
阅读次数:
302
The Euler functionhttp://acm.hdu.edu.cn/showproblem.php?pid=2824筛法 1 #include 2 #include 3 #define mt(a,b) memset(a,b,sizeof(a)) 4 typedef __int64 LL;...
分类:
其他好文 时间:
2014-08-03 17:43:45
阅读次数:
248
一个map的超水题。#include #include #include #include #include #include #define LL long longusing namespace std;const int maxn = 200010;const int maxm = 20010...
分类:
其他好文 时间:
2014-08-03 15:05:15
阅读次数:
175
题目链接:点击打开链接
#include
#include
#include
using namespace std;
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
typedef long long ll;
int main()
{
int i, j;
double m,n;
while...
分类:
其他好文 时间:
2014-08-02 18:20:43
阅读次数:
233
/*从要删除最后一个到第一个进行松弛操作, 因为如果从第一个到最后一个进行松弛操作,弟24行有可能不会更新,若要更新,就需要再一次对d[N][N]初始化*/ 1 #include 2 #include 3 using namespace std; 4 typedef long long ll;...
分类:
其他好文 时间:
2014-08-02 18:06:53
阅读次数:
186
题目链接题意:分析: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define LL long long 9 using namespace std;10 11 int ...
分类:
其他好文 时间:
2014-08-02 12:43:43
阅读次数:
217