上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 47 下一页

2012年8月10日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1712赤裸裸的分组背包View Code #include <iostream>using namespace std ;int dp[101] ;int val[101][101] ;int main(){ int n,m ; while(scanf("%d%d",&n,&m),(n||m)) { for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) scanf("%d",&val[i] 阅读全文
posted @ 2012-08-10 17:14 LegendaryAC 阅读(147) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2159二维费用的背包wa了好多次,要求最大忍耐度,开始没处理好,想当然了View Code #include <iostream>using namespace std ;int dp[101][101] ;int w[101],c[101] ;int main(){ int n,m,k,s ; while(~scanf("%d%d%d%d",&n,&m,&k,&s)) { for(int i=0;i<k;i++) scanf(" 阅读全文
posted @ 2012-08-10 15:44 LegendaryAC 阅读(132) 评论(0) 推荐(0) 编辑

2012年8月6日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3068新学的算法,求回文串用Manacher算法讲解:http://acm.uestc.edu.cn/bbs/simple/?t3258.htmlView Code #include using namespace... 阅读全文
posted @ 2012-08-06 17:05 LegendaryAC 阅读(384) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1757还是矩阵+快速幂,注意要把初值乘回去并且注意方向View Code #include using namespace std ;void mul(int a[11][11],int b[11][11],int... 阅读全文
posted @ 2012-08-06 17:03 LegendaryAC 阅读(150) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1575矩阵+快速幂A^k是A*A*A...(k个A相乘)View Code #include using namespace std ;void mul(int a[11][11],int b[11][11],in... 阅读全文
posted @ 2012-08-06 11:24 LegendaryAC 阅读(278) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2065dp转移方程:dp[i][1]=2*dp[i-1][1]+dp[i-1][2]+dp[i-1][3];dp[i][2]=dp[i-1][1]+2*dp[i-1][2]+dp[i-1][4];dp[i][3]=... 阅读全文
posted @ 2012-08-06 10:34 LegendaryAC 阅读(437) 评论(0) 推荐(0) 编辑

2012年8月5日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1005神奇的矩阵View Code #include <iostream>using namespace std ;void mul(int a[2][2],int b[2][2]){ int c[2][2] ; c[0][0]=(a[0][0]*b[0][0]+a[0][1]*b[1][0])%7 ; c[0][1]=(a[0][0]*b[0][1]+a[0][1]*b[1][1])%7 ; c[1][0]=(a[1][0]*b[0][0]+a[1][1]*b[1][0])%7 ; ... 阅读全文
posted @ 2012-08-05 20:55 LegendaryAC 阅读(141) 评论(0) 推荐(0) 编辑

2012年8月3日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4339血与泪,伤与痛,无须多言线段树找数列中任意起点最多有多少连续的1View Code #include <iostream>#include <string.h>using namespace std ;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1const int maxn=1000001 ;char s1[maxn],s2[maxn] ;int tree[maxn<<2] ;int n ;v 阅读全文
posted @ 2012-08-03 16:37 LegendaryAC 阅读(216) 评论(0) 推荐(0) 编辑
 
摘要: http://poj.org/problem?id=1269两条直线,平行输出NONE,共线输出LINE,相交输出交点坐标p0为交点,求交点坐标的方法是(p1-p0)X(p2-p0)=0 && (p3-p0)X(p4-p0)=0(其中X代表向量叉乘),联立两个方程可求解求得解分母为0时,判断一条直线中的一个点是否在另一条直线上(用上面叉乘的方法),如果是就共线,反之平行View Code #include <iostream>#include <stdio.h>using namespace std ;struct point{ int x,y ;} ; 阅读全文
posted @ 2012-08-03 11:53 LegendaryAC 阅读(186) 评论(0) 推荐(0) 编辑

2012年8月2日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2199找到方程的解,直接二分,注意精度View Code #include <iostream>using namespace std ;const double eps=1e-8 ;double f(double x){ return 8*x*x*x*x+7*x*x*x+2*x*x+3*x+6 ;}int main(){ int t ; double mid ; scanf("%d",&t) ; while(t--) { double y ; ... 阅读全文
posted @ 2012-08-02 20:38 LegendaryAC 阅读(197) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 47 下一页