- 博客(3)
- 资源 (3)
- 收藏
- 关注
原创 poj 1742 Coins (背包)
这道题直接多重背包算的话会超时,但是按完全背包dp但在计算过程中用一个标记数组标记一下加了几次该coin 得到该值。这样可以使时间复杂度降低很多。。。 #include #include #include #include #include using namespace std; const int N = 111; const int M = 111111; int a[N],
2013-05-27 15:17:50 805
原创 Poj 3150 Cellular Automaton(矩阵快速幂, 循环矩阵快速幂)
注意数组要开成long long 否则会溢出。 #include #include #include using namespace std; #define N 555 #define LL long long #define FF(i,n) for(i=0;i<n;i++) LL f[N]; LL ans[N]; LL init[N]; LL buf[N];
2013-05-22 23:19:36 1099
原创 矩阵快速幂模板
#define N 555 #define FF(i,n) for(i=0;i<n;i++) int f[N]; int ans[N][N]; int init[N][N]; int buf[N][N]; void matrixMul(int a[][N],int b[][N],int n,int mod){ i
2013-05-22 15:28:44 800
数位计数问题解法研究
2013-10-07
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人