1.题目链接。emmm,这个题的意思就是找到一个多边形把所有的点都围起来,然后计算这个多边形的周长。一看就是一个凸包嘛
原创
2022-07-01 10:33:17
48阅读
第一次做凸包,这道题要特殊考虑下,n=2时的情况,要除以二才行。我是从最左边的点出发,每次取斜率最大的点,一直到最右边的点。然后从最左边的点出发,每次取斜率最低的点,一直到最右边的点。#include<stdio.h>#include<math.h>#include<algorithm>#include<string.h>using namespace std;const double eps=1e-9;struct node{ double x,y;}f[105];bool flag[105];int n;bool cmp(node a,nod
转载
2013-06-21 14:25:00
111阅读
Surround the Trees
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7164 Accepted Submission(s): 2738Problem Description
There are a lot
转载
2016-01-08 20:58:00
69阅读
2评论
The
原创
2022-09-26 14:37:39
66阅读
题解:计算凸包……#include #include #include #include using namespace std; struct node{int x,y;}vex[1005],stackf[1005]; bool cmp1(node a,node b){ if(a.y==b.y)return a.x0?1:0; } int main(){ int t; while(scanf("%d",&t),t!=0){ for(int i=0;i=1&&cross(stackf[top-1],stackf[top],vex...
转载
2014-04-07 13:13:00
80阅读
2评论
Surround the Trees Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9703 Accepted Submission(s): 3
原创
2021-07-21 16:21:21
131阅读
题目传送门 今天突然想学习一下凸包,没想到还挺简单的 这是一道凸包模板题目 代
原创
2022-11-09 18:26:37
56阅读
HDU 1392 Surround the Trees (凸包)题意给定二维平面nnn个点坐标,求凸包周长。思路GrahamGrahamGraham 扫描法,有时间具体写。代码先贴上#include<bits/stdc++.h>using namespace std;typedef long long ll;const int N=1e5+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;#define mst(a,b) memset(a,b,size
原创
2021-08-10 08:43:37
112阅读
题意:
原创
2022-11-17 00:05:22
25阅读
HDU 1392 Surround the Trees (凸包)题意给定二维平面nnn个点坐标,求凸包周长。思路GrahamGrahamGraham 扫描法,有时间具体写。代码先贴上#include<bits/stdc++.h>using namespace std;typedef long long ll;const int N=1e5+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;#define mst(a,b) memset(a,b,size
原创
2022-01-21 11:09:39
63阅读
【题意】给n个点求凸包。【分析】求凸模板,这里注意特判n==2的情况,没注意到WA一回!【AC代码】#include #include #include #include #include #include #include using namespace std;const int maxn = 10010;const double PI = acos(-1);s
原创
2022-04-20 10:29:35
55阅读
include <cst
原创
2022-11-23 10:08:54
22阅读
Problem Description
There are a lot of trees in an area. A peasant wants to buy a rope t
原创
2023-05-30 05:07:41
76阅读
又是一道模板题#include #include #include #include #include #include #include using namespace std;struct P{ int x,y; double angle;} p[50010];bool cmp(P p1,P p2){ return p1.angle > p2.angle;}double calangle(P p,P t){ return ((t.x-p.x)*(t.x-p.x) + 1 - (t.x-p.x-1)*(t.x-p.x-1))/(2*sqrt((t.x-p.x)*(t....
转载
2013-10-15 18:44:00
37阅读
2评论
Surround the TreesTime Limit: 2000/1000 MS (Java/Others) Memory
原创
2023-03-02 09:30:34
74阅读
Surround the Trees Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Description There are a lot of trees in an
转载
2017-08-25 15:00:00
70阅读
Surround the TreesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7672 Accepted Submission(s): 2936Problem DescriptionThere are a
原创
2023-02-17 09:37:02
40阅读
<题目链接>
题目大意:
给出一些点,让你求出将这些点全部围住需要的多长的绳子。
Andrew算法
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
转载
2018-08-22 22:55:00
68阅读
2评论
1.解决mysql–Can’t get stat of ” (Errcode: 13)今天在导入mysql数据的时候,出现下面的错误:mysql> load data infile '/root/aaa' into table test fields terminated by ',' lines terminated by '\n';
mysql> ERROR 13 (HY000):
凸包问题,求出凸包后,计算距离,不知道为什么n==2的情况居然不是两点距离的2倍,而是正好是两点的距离。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>#include <cmath>using namespace std;#define maxn 505struct point{ double x, y;}pnt[maxn], res[maxn];int n, m;b
转载
2011-03-29 21:45:00
53阅读
2评论