上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 42 下一页
摘要: 如下:heapify每次把当前分支的最小的放在top然后遍历每个“小树”,即可。。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 const int maxn = 100005; 6 #define LEFT( x ) ((x<<1)+1) 7 #define RIGHT( x ) ((x+1)<<1) 8 #define PARENT( x ) ((x-1)/2)//((x+1)> 阅读全文
posted @ 2013-03-24 13:40 xxx0624 阅读(410) 评论(0) 推荐(0) 编辑
摘要: 开一个二维数组记录星号的个数。。。。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 const int maxn = 2005; 6 int sum[ maxn ][ maxn ];//sum[i][j]:记录从mat 1 1到mat i j 的“ * ”的个数 7 int mat[ maxn ][ maxn ]; 8 char s[ maxn ]; 9 int main(){10 int n,m;11 whil 阅读全文
posted @ 2013-03-23 22:13 xxx0624 阅读(330) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /* 2 几何+判断点在四边形内 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue> 10 //#include<map> 11 #include<math.h> 12 using namespace std; 13 typedef long long ll; 14 //ty 阅读全文
posted @ 2013-03-23 15:23 xxx0624 阅读(209) 评论(0) 推荐(0) 编辑
摘要: View Code 1 /* 2 最大连续上升子序列和 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue>10 //#include<map>11 #include<math.h>12 using namespace std;13 typedef long long ll;14 //typedef 阅读全文
posted @ 2013-03-23 13:08 xxx0624 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 腾讯马拉松水~~注意是12小时一周期!!!!!!!!!!!!!!!!!!!!!!!View Code 1 #include<stdio.h> 2 #include<string.h> 3 struct node{ 4 int h,m,s,all; 5 }; 6 node now,pre,tmp; 7 int main(){ 8 int n; 9 scanf("%d",&n);10 while( n-- ){11 scanf("%d:%d:%d",&now.h,&now.m,&now.s);12 no 阅读全文
posted @ 2013-03-22 22:41 xxx0624 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 const int maxn = 205; 6 int a[ maxn ],b[ maxn ],dp[ maxn ]; 7 阅读全文
posted @ 2013-03-22 22:18 xxx0624 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 简单的并查集View Code 1 /* 2 并查集 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue>10 //#include<map>11 #include<math.h>12 using namespace std;13 typedef long long ll;14 //typedef _ 阅读全文
posted @ 2013-03-20 20:16 xxx0624 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 栈的应用View Code 1 /* 2 栈 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue>10 #include<stack>11 //#include<map>12 #include<math.h>13 using namespace std;14 typedef long lo 阅读全文
posted @ 2013-03-20 20:09 xxx0624 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 点B到直线AC的距离 就是 |AB X AC|/|AC| ‘X’是叉乘 ’ || ‘表示模View Code 1 /* 2 三维+点到直线的距离 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue>10 //#include<map>11 #include<math.h>12 using namesp 阅读全文
posted @ 2013-03-19 21:52 xxx0624 阅读(683) 评论(0) 推荐(0) 编辑
摘要: 二维叉积View Code 1 struct point{2 double x,y;3 };4 double xmult( point a,point b,point c ){5 return ( b.x-a.x )*( c.y-a.y )-( b.y-a.y )*( c.x-a.x );6 }c||a-- -- -- -- --b由b转向a!!三维叉积设A(x1,y1,zi)、B(x2,y2,z2)、C(x3,y3,z3)为不共线三点,向量AB={x2-x1,y2-y1,z2-z1}向量AC={x3-x1,y3-y1,z3-z1}由A、B、C三点确定的平面的法向量就是向量AB... 阅读全文
posted @ 2013-03-19 21:49 xxx0624 阅读(410) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 42 下一页