随笔分类 - 几何
摘要:比较水的题,但是要细心,把情况考虑清楚#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
const int maxn=10000;
const double eps=1e-8;
int n,f[maxn];
double rad;
struct Point
{ double x,y;
};
Point ver[maxn],pel;
double cross(Point a,Point b,Point c,Point d)
{ return (b.x-a.x
阅读全文
摘要:直线的交点,题目不是很难,但还是太粗心,其中有一步疏忽,导致无限wa,最后还是发现了#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
const int maxn=10000;
double eps=1e-10;
struct node
{ double x1,x2,y;
};
struct Point { double x,y; Point(double x=0,double y=0):x(x),y(y) {};
};
node arc[maxn
阅读全文
摘要:凸包至今还不知道这道题为什么凸包就是解,在网上搜结题报告也都是说求凸包,没告诉深层原因,求大神解答#include <iostream>
#include <cstdio>
#include <algorithm>
#include <math.h>
using namespace std;
const int maxn=1000+10;
struct node
{ int x,y;
};
node point[maxn];
int ch[maxn];
int n,l;
bool cmp(node a,node b)
{ if(a.x<b.
阅读全文
摘要:哎~~~~~~~~~~~~#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
const int maxn=25*2;
const double eps=1e-8;
struct Point
{ double x,y;
};
int n;
double maxv;
Point up[maxn],bottom[maxn];
struct Line{ double a, b, c;
};
double cross(Point a,Point b,Point c
阅读全文
摘要:贪心+计算几何(叉点积)个人认为本体用贪心解释最合理,我就是用贪心思考的此题代码些的太挫啦#include <iostream>#include <stdio.h>#include <stack>#include <math.h>#include <string.h> using namespace std;const int maxn=55;int m,n;int vis[maxn];int path[maxn];struct Point{ int x,y; Point(int x=0,int y=0):x(x),y(y) { }}
阅读全文
摘要:题目不难,就是线段相交判断。叉积和点积的应用,但是却需要细心,看清题意#include <iostream>#include <stdio.h>using namespace std;int cross(int x1,int y1,int x2,int y2){ return x1*y2-y1*x2;}int dot(int x1,int y1,int x2,int y2){ return x1*x2+y1*y2;}int ons(int x1,int y1,int x2,int y2,int x3,int y3){ if(cross(x3-x1,y3-y1,x3-x2
阅读全文
摘要:虽然这道题没有用什么算法,但却锻炼了思维//矢量分解
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
double l,w,x,y,r,a,v,s;
int main()
{ while(cin>>l>>w>>x>>y>>r>>a>>v>>s) { if(!l&&!w&&!x&&!y&&!r&
阅读全文

浙公网安备 33010602011771号