Description There are a lot of trees in an area. A peasant wants to buy a rope to surround all these trees. So at first he must know the minimal required length of the rope. However, he does not kn
原创
2021-07-12 17:31:05
154阅读
题目链接:戳我 凸包模板 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #define MAXN 100010 using namespace std; int n,
原创
2021-07-15 13:48:18
96阅读
Surround the Trees Problem Description There are a lot of trees in an area. A peasant wants to buy a rope to surround all these trees. So at first he
转载
2016-12-26 17:43:00
104阅读
2评论
题解:计算凸包……#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评论
题目传送门 今天突然想学习一下凸包,没想到还挺简单的 这是一道凸包模板题目 代
原创
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阅读
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1392Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionThere are a lot of trees in an area. A peasant...
原创
2022-02-03 15:06:25
43阅读
【题意】给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阅读
Surround the TreesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9158 Accepted Submission(s): 3508Problem DescriptionThere are a
原创
2023-04-20 07:01:03
73阅读
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1392Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionThere are a lot of trees in an area. A peasant...
原创
2021-07-14 10:42:46
71阅读
Surround the Trees Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7203 Accepted Submission(s):
转载
2016-04-13 12:33:00
72阅读
又是一道模板题#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阅读
第一次做凸包,这道题要特殊考虑下,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) Problem Description There are a lot of trees in an
转载
2017-08-25 15:00:00
70阅读
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评论
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阅读