摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1513最长公共子序列模版题。View Code 1 #include <cstdio> 2 #include<iostream> 3 #include<string.h> 4 using namespace std; 5 char cc[5001]; 6 int dp[2][5001]; 7 int n; 8 inline int Min(int x,int y) 9 {10 return x>y?y:x;11 }12 int main()13 {14 whi. 阅读全文
posted @ 2012-09-13 21:01 淡墨æ末央 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 链接:http://poj.org/problem?id=1845将A进行质因数分解,则A^B=(p1^k1)*(p2^k2)*...*(pn^kn)根据公式,所有因子之和为 (1+p1+p1^2+...p1^k1)*(1+p2+p2^2+...p2^k2)*...*(1+pn+pn^2+...+pn^kn) 计算1+p+p^2+...p^n可以利用二分进行加速 当n为奇数时 1+p+p^2+...p^n=(1+p+p^2+...+p^(k/2))*(1+p^(k/2+1)) 当n为偶数时 1+p+p^2+...p^n=(1+p+p^2+...+p^(k/2-1))*(1+p^(k/2+1)) 阅读全文
posted @ 2012-09-13 16:29 淡墨æ末央 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1172View Code 1 #include <cstdio> 2 #include <iostream> 3 #include <cmath> 4 #include <cstdlib> 5 #include <cstring> 6 #include <algorithm> 7 using namespace std; 8 typedef long long LL; 9 int s[110][3];10 int test( int 阅读全文
posted @ 2012-09-13 12:28 淡墨æ末央 阅读(203) 评论(0) 推荐(0) 编辑