08 2012 档案

 
哈哈哈
摘要:天天受刺激,表示已经完全习惯被虐 阅读全文
posted @ 2012-08-21 22:30 LegendaryAC 阅读(115) 评论(0) 推荐(0)
无奈
摘要:最近在重头刷usaco,里面每一道题A过一遍都不想做第二遍了,把我这个巨菜恶心的够呛和狗说好搞dp和线段树还没搞,现在要开始下手了usaco什么时候都做完再一起总结吧 阅读全文
posted @ 2012-08-19 17:29 LegendaryAC 阅读(95) 评论(0) 推荐(0)
HDU 1712 ACboy needs your help
摘要: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 阅读(158) 评论(0) 推荐(0)
HDU 2159 FATE
摘要: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 阅读(140) 评论(0) 推荐(0)
HDU 3068 最长回文
摘要: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 阅读(393) 评论(0) 推荐(0)
HDU 1757 A Simple Math Problem
摘要: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 阅读(163) 评论(0) 推荐(0)
HDU 1575 Tr A
摘要: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 阅读(288) 评论(0) 推荐(0)
HDU 2065 "红色病毒"问题
摘要: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 阅读(446) 评论(0) 推荐(0)
HDU 1005 Number Sequence
摘要: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 阅读(152) 评论(0) 推荐(0)
HDU 4339 Query
摘要: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 阅读(226) 评论(0) 推荐(0)
POJ 1269 Intersecting Lines
摘要: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 阅读(192) 评论(0) 推荐(0)
HDU 2199 Can you solve this equation?
摘要: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 阅读(205) 评论(0) 推荐(0)
HDU 3333 Turing Tree
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3333离线算法,和上一题一模一样。。。View Code #include <iostream>#include <algorithm>#include <map>using namespace std ;const int maxn=30001 ;typedef __int64 LL ;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1map <int,int> hash ;struct n 阅读全文
posted @ 2012-08-02 20:37 LegendaryAC 阅读(122) 评论(0) 推荐(0)
HDU 3874 Necklace
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3874今天和涂涂新学的离线算法,太牛了大概就是先接收所有数据,然后按查询右边界排序,从左往右更新,遇到之前加过的数就删掉,因为按右边界排序,所以查询区间不断右移,删掉不会出错View Code #include #... 阅读全文
posted @ 2012-08-02 20:35 LegendaryAC 阅读(281) 评论(0) 推荐(0)