摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>#include<algorithm>using namespace std;struct point{ double x; double y;}p[20];struct T{ int xx;// int yy;// int zz;// double mianji;//}res;bool cmp(int a,int b){ return a<b;}point operator-(const p 阅读全文
posted @ 2012-07-24 21:59 willzhang 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 极角排序#include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>#include<algorithm>using namespace std;struct point{ double x; double y;}a[55];double mu(point a,point b){ return a.x*b.y-b.x*a.y;}bool cmp(const point &a,const point &b){ return mu(a,b)> 阅读全文
posted @ 2012-07-24 20:27 willzhang 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 纯水题,注意交点不一定是第二个点和第三个点#include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>#include<algorithm>using namespace std;struct Vector{ double x; double y;};struct point{ double x; double y;};Vector operator-(const point a,const point b){ Vector temp; temp.x=a.x 阅读全文
posted @ 2012-07-23 21:24 willzhang 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 看错题意,白贡献了4个RE#include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>__int64 parent[31000];__int64 total[31000];__int64 under[31000];__int64 getparent(__int64 x){ if(parent[x]==x) { return x; } __int64 t=getparent(parent[x]); under[x]+=under[parent[x]]; parent[x. 阅读全文
posted @ 2012-07-23 10:37 willzhang 阅读(192) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>#include<algorithm>int parent[30010];int total[30010];using namespace std;int getparent(int s){ if(parent[s]==s) { return s; } return parent[s]=getparent(parent[s]);}void Merge(int a,int b){ int m,n; m 阅读全文
posted @ 2012-07-23 09:33 willzhang 阅读(116) 评论(0) 推荐(0) 编辑
摘要: ◦旋转: –n个点顺时针旋转i个位置的置换,循环数为gcd(n,i),方案数为3gcd(n,i) ◦翻转: –n为偶数时,对称轴不过顶点的循环数为n/2,方案数为3n/2;对称轴过顶点的循环数为n/2+1,方案数为3n/2+1–n为奇数时,循环数为(n+1)/2,方案数为3(n+1)/2 #include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>#include<algorithm>using namespace std;__int64 gcd(__int 阅读全文
posted @ 2012-07-22 21:09 willzhang 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 252K 16MS#include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>#include<algorithm>using namespace std;struct point{ double x; double y;};struct map{ point up; point down;}m[1000];struct node{ int L; int R; node *left; node *right; double len;//区间的长度 int c 阅读全文
posted @ 2012-07-19 09:20 willzhang 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 34772K 63MS#include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>#include<algorithm>using namespace std;struct post{ int head; int tail;}p[10010];struct node{ node *left; node *right; int L; int R; bool bcover;};node tree[1000000];int npoint;int endpoint[ 阅读全文
posted @ 2012-07-17 10:50 willzhang 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 空间8220K 时间3344MS瞻仰时间在1000ms内的神#include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>#include<algorithm>using namespace std;struct node{ __int64 L; __int64 R; node *left; node *right; __int64 sum; __int64 inc;};__int64 ncount=0;node tree[200010];void build 阅读全文
posted @ 2012-07-17 09:17 willzhang 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 线段树,第一次写,2516K 1829MS#include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>#include<algorithm>using namespace std;int cow[50005];#define my_max 1000010#define my_min -1000010int resmax;int resmin;struct node{ int nmax; int nmin; int L; int R; node *left; 阅读全文
posted @ 2012-07-16 21:06 willzhang 阅读(119) 评论(0) 推荐(0) 编辑