上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页
摘要: 题意:Iserlohn 要买运动鞋,商店总共有N双运动鞋,他总共有M元钱,这些运动鞋分为K类,每类都有自己的编号i,每类中的每双鞋有单价m,和Iserlohn对这双鞋的评价价值v。Iserlohn想每一类运动鞋至少买一双,在不超过他所拥有的总金额前提下,使他得到的v最大。http://acm.hdu.edu.cn/showproblem.php?pid=3033 1 #include <iostream> 2 #include <cstdio> 3 #include <vector> 4 #include <cstring> 5 using na 阅读全文
posted @ 2012-08-13 10:13 qijinbiao1 阅读(400) 评论(1) 推荐(0) 编辑
摘要: 题意:Roy 去抢N个银行,去抢第j个银行时能得到Mj的钱,被抓的概率为Pj。问在被抓的概率不大于P时能抢到的最多的钱是多少。 1 #include <iostream> 2 #include <cstdio> 3 #include <map> 4 #include <cstring> 5 using namespace std; 6 const int Ni = 110; 7 int money[Ni]; 8 double dp[10100]; 9 double pro[Ni];10 int dcmp(double a,double b)11 阅读全文
posted @ 2012-08-13 08:38 qijinbiao1 阅读(197) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1828求矩形的周长 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #define lson l,mid,i<<1 5 #define rson mid+1,r,i<<1|1 6 using namespace std; 7 const int Ni = 40100; 8 struct node{ 9 int l,r,h,s;10 node(){}11 node(i 阅读全文
posted @ 2012-08-07 10:09 qijinbiao1 阅读(206) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1542 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 #define lson l,mid,i<<1 6 #define rson mid+1,r,i<<1|1 7 using namespace std; 8 const int Ni = 210; 9 int n;10 struct node {11 dou 阅读全文
posted @ 2012-08-06 20:27 qijinbiao1 阅读(629) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3397空间要开大点不然就RE。更新比较复杂,在取反时要注意先向下更新。如这样的数据:110 100 0 0 1 1 0 1 0 1 12 0 92 0 94 0 21 0 92 0 84 0 2 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #define lson l,mid,i<<1 5 #define rson mid+1,r,i<<1|1 6 using na 阅读全文
posted @ 2012-08-06 12:20 qijinbiao1 阅读(154) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3468题意: 有n个整数A1,A2,……,An,给你两种操作,一个是给区间[l,r]的值都增加m,一个是问区间[l,r]的和是多少。 1 #include <iostream> 2 #include <cstdio> 3 #define lson l,mid,i<<1 4 #define rson mid+1,r,i<<1|1 5 using namespace std; 6 const int Ni = 100010; 7 long long tree[Ni*3]; 8 long long 阅读全文
posted @ 2012-08-03 21:43 qijinbiao1 阅读(196) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1394线段树记录区间[a,b]里面出现了多少个数字,查询时只要查询区间[x,n-1]有多少个数出现过,就知道前面有多少个数比x大,也就知道x有多少逆序数。把一个序列最前面的数字x移到最后就会产生n-1-x-x个逆序:x在最前时它后面有x个数(0到x-1)比x小,所以把x移到最后以后逆序数要减x个;x在最前时它后面有n-1-x个数(x+1到n-1)比x大,所以把x移到最后以后逆序数增加n-1-x个;所以,最前面的数字x移到最后就会新产生n-2*x-1个逆序 1 #include <iostream> 阅读全文
posted @ 2012-08-02 10:00 qijinbiao1 阅读(183) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4325题意: 有n种花每种开放的时间从a到b(a到b的闭区间),问t时刻有多少种花开着(n<=10^6,a<=b<10^9) 1 #include <cstdio> 2 #include <algorithm> 3 #include <iostream> 4 using namespace std; 5 const int Ni = 1000010; 6 struct node { 7 int l,r,sum; 8 }tree[Ni*3]; 9 struc 阅读全文
posted @ 2012-08-01 09:57 qijinbiao1 阅读(192) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3631 1 #include <iostream> 2 #include <cmath> 3 #include <cstdio> 4 #include <algorithm> 5 using namespace std; 6 int arr[50]; 7 int n,mx,m; 8 void dfs(int cur,int total) 9 {10 if(mx==m) return ;11 if(total>mx&am 阅读全文
posted @ 2012-07-30 16:23 qijinbiao1 阅读(186) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1115定理1 已知三角形△A1A2A3的顶点坐标Ai ( xi , yi ) ( i =1, 2, 3) 。它的重心坐标为: xg = (x1+x2+x3) / 3 ; yg = (y1+y2+y3) / 3 ;定理2 已知三角形△A1A2A3的顶点坐标Ai ( xi , yi ) ( i =1, 2, 3) 。该三角形的有向面积为: S =((x2 - x1) * (y3 -y1) - (x3 - x1) * (y2 - y1) ) / 2 ; △A1A2A3 边界构成逆时针回路时取+#incl... 阅读全文
posted @ 2012-07-30 15:39 qijinbiao1 阅读(182) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页