上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页
摘要: #include#include #include #include using namespace std;int f[10002],num[10002];int find(int x){ return f[x]==x?x:f[x]=find(f[x]);}int main(){ int i,j,n,m,t,k,a,len,b; scanf("%d",&t); while(t--) { scanf("%d%d%d",&n,&m,&k); for(i=0;i#include#includeusing namespace s 阅读全文
posted @ 2013-10-07 16:11 galaxy77 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 【题意】:给出n个点的坐标 求这里面两点距离的平方最大的 输出其值#include#include#includeusing namespace std;struct point{int x;int y;};point p[60000],ch[60000],v,w;int m,n;int cmp(point a,point b){ if(a.x!=b.x) return a.x1&&cross(ch[m-1],ch[m-2],p[i])1 再判断后面的 { m--; } ch[m].x=... 阅读全文
posted @ 2013-09-30 19:59 galaxy77 阅读(175) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #includeusing namespace std;int main(){ map mapStudent; mapStudent["student_one\0"]=1; mapStudent["student_two\0"]=2; mapStudent["student_three\0"]=3; if(mapStudent.find("student_four\0")==mapStudent.end()) mapStudent["student_f 阅读全文
posted @ 2013-09-27 11:03 galaxy77 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 给出圆心坐标和半径 还有线段的两个端点判断线段是全在圆内还是部分在圆内 或是 全在圆外#include#include#includeusing namespace std;struct point{double x;double y;};double length(point a,point b){ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); }double dot(point a,point b){ return a.x*b.x+a.y*b.y;}double cross(point a,point b){ ... 阅读全文
posted @ 2013-09-26 21:35 galaxy77 阅读(405) 评论(0) 推荐(0) 编辑
摘要: poj 3207 Ikki's Story IV - Panda's Trick http://poj.org/problem?id=3207【题意】在一个环上有n个点 m组连线(连接这两个点的线可以在环内也可以在环外) 判断这些线是否可以互不相交(第一次写的 2-sat 还蛮顺利的 1a 哈~~) 1 #include 2 #include 3 #include 4 using namespace std; 5 6 vector g[1002]; 7 8 int vis[1002],u[1002],v[1002],c,w[1002],m,n; 9 int max(int... 阅读全文
posted @ 2013-09-23 21:20 galaxy77 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 最优比率生成树poj 2728 Desert King http://poj.org/problem?id=2728题意:有n个村庄,村庄在不同坐标和海拔,现在要对所有村庄供水,只要两个村庄之间有一条路即可,建造水管距离为坐标之间的欧几里德距离(好象是叫欧几里德距离吧),费用为海拔之差现在要求方案使得费用与距离的比值最小 http://www.cppblog.com/jh818012/articles/167743.html 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define INF 1000 阅读全文
posted @ 2013-09-18 20:54 galaxy77 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 今天数值分析课上讲了一个很有用的求多项式的方法,给n个点的坐标就可以求出这个函数的多项式来 如给两个点就可以求出这条直线的多项式 给三个点就可以求出这条抛物线(或直线)的多项式最简单的一个应用就是 已知两点的坐标 求这条直线的函数接下来把值带进去就行了不得不说这个还真的是 很难画诶。。。 = = 阅读全文
posted @ 2013-09-13 22:38 galaxy77 阅读(202) 评论(0) 推荐(0) 编辑
摘要: poj 1679 The Unique MST http://poj.org/problem?id=1679求最小生成树是否唯一把构成最小生成树的边一条条的删#include#include#include#include#includeusing namespace std;struct E{ friend bool operator n2.w; } int u;int v;int w;}edge[10000];vector g[102];priority_queue q;int n,f[102],vis[102];int find(int a){ return ... 阅读全文
posted @ 2013-09-10 20:44 galaxy77 阅读(192) 评论(0) 推荐(0) 编辑
摘要: poj 1094 Sorting It All Out http://poj.org/problem?id=1094【题意】:给出n个点 m对大小关系 求输入第几对关系的时候 可以把整个图n个点的大小关系确定 或出现环 一旦发现出现了环或确定下了大小关系后面的都不用管了 做法是: 每进去一条边就判断一次 一发现都上述两种情况就可以输出了 1 #include 2 #include 3 using namespace std; 4 int g[100][100],ss[100],n,m,degree[100],uu[1000],vv[1000],temp[100]; 5 6 7 int so.. 阅读全文
posted @ 2013-09-10 20:32 galaxy77 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 待续。。。 阅读全文
posted @ 2013-09-10 16:30 galaxy77 阅读(161) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页