上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 42 下一页
判断重心在每条凸包边上的的垂足是否在凸包边上,计算几何一般思路很清晰,就是实现起来有点烦,这里错一点,那里错一点,所以,以后决定要把几何题放最后做了第一种方法:求出垂足再判断#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>using namespace std;const double eps = 1e-8;struct point { double x,y; point operator - (const point& t) const { po Read More
posted @ 2011-10-18 11:07 Because Of You Views(444) Comments(0) Diggs(0)
import java.io.*;import java.util.*;import java.math.*;public class Main{ public static void main(String[] args) { String s; BigInteger a,b,c; Scanner sc=new Scanner(System.in); Scanner cin=new Scanner(System.in); b=BigInteger.valueOf(0); while(cin.has... Read More
posted @ 2011-10-17 18:59 Because Of You Views(205) Comments(0) Diggs(0)
View Code 需要离散化,但用map就方便多了了#include<stdio.h>#include<string.h>#include<map>using namespace std;const int maxn = 10010;int rank[maxn],p[maxn];int n,m;void init(){ int i; for(i=0;i<=10000;i++) { p[i]=i; rank[i]=0; }}int find(int x){ if(p[x]==x) return x; int tx=fi... Read More
posted @ 2011-10-14 21:36 Because Of You Views(347) Comments(0) Diggs(0)
其实topcoder也是蛮有意思的啊,就刷了题水的View Code #include<stdio.h>#include<vector>#include<string>using namespace std;class RedAndGreen{public : int minPaints(string row) { int i,j; int a[55],flag[55]; memset(flag,0,sizeof(flag)); int len=row.length(); int tot=0; fo... Read More
posted @ 2011-10-13 21:11 Because Of You Views(158) Comments(0) Diggs(0)
第一次做,模仿着敲的View Code #include<stdio.h>#include<string.h>#define maxn 1000000struct que{ int x,val; que(int xx,int yy):x(xx),val(yy){} que(){};}q[maxn];int main(){ int t; char name[6],na[10]; int rp; scanf("%d",&t); while(t--) { int i,j,k,head=0,tail=-1,leave=0,K=1; ... Read More
posted @ 2011-10-13 16:36 Because Of You Views(317) Comments(0) Diggs(0)
终极模板View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;const int N = 10010;const int M = 100010;int min(int a,int b){ return a>b?b:a;}struct EDGE{ int to,next,id;}edge[2*M];int n,m,tot,tdfn,nbridge;int head[N],vis[N],low[N],dfn[N],bridge[M];void Read More
posted @ 2011-10-13 09:09 Because Of You Views(299) Comments(0) Diggs(0)
直接用模板的,但浙大费马点的模板貌似不太好用啊。。。就自己写了注意题目给出的是三边长,要先把这三边转换成三个顶点坐标。另外,三角形中有一个角的角度大于120度时,距离之和就为三角形较短两边之和View Code #include<stdio.h>#include<math.h>#include<string.h>#include<algorithm>using namespace std;const double pi=acos(-1.0);struct point{double x,y;};struct line{point a,b;};dou Read More
posted @ 2011-10-12 16:41 Because Of You Views(460) Comments(0) Diggs(0)
View Code #include<stdio.h>#include<string.h>#include<stdlib.h>struct node{ char num; struct node *left; struct node *right; // node():left(NULL),right(NULL){}};node *build(node *root,char ch){ if(root==NULL) { root=new node; root->left=NULL; root->right=NULL; ... Read More
posted @ 2011-10-12 12:12 Because Of You Views(316) Comments(0) Diggs(0)
View Code #include<stdio.h>#include<string.h>int T,cases,n,k,m,fsize;int isver[25];int speed[25][25];int online[25][1010];int get[25];int start[25];void init(){ memset(isver,0,sizeof(isver)); memset(online,0,sizeof(online)); memset(get,0,sizeof(get)); memset(start,-1,sizeof(start));}int Read More
posted @ 2011-10-11 21:11 Because Of You Views(295) Comments(0) Diggs(0)
注意,初始化时当期时间戳就设为1在这里没错,但在poj1144就会错所以我改了改,初始化时就设为0了求割点的思想图论书上介绍的很详细了,推荐北京大学出版社出版的《图论算法理论、实现及其应用》View Code #include<stdio.h>#include<string.h>#define bug() {puts("bugbug");} const int M = 1010;int dfn[M],low[M];int head[1010];struct node{ int v; int next;}edge[100];int subnet[M]; Read More
posted @ 2011-10-10 12:35 Because Of You Views(274) Comments(0) Diggs(0)
上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 42 下一页