最大三角形
来源:互联网 发布:服务贸易数据 编辑:程序博客网 时间:2024/06/10 18:47
#include <bits/stdc++.h>using namespace std;typedef long long ll;ll read(){ ll ret=0; char ch=getchar(); while(ch<'0'||ch>'9') ch=getchar(); for(; ch>='0'&&ch<='9'; ch=getchar()) ret=ret*10+ch-'0'; return ret;}ll readf(){ ll t=0,flag=1; char c=getchar(); while(c<'0'||c>'9'||c=='-') { if(c=='-')flag=-1; c=getchar(); } while(c>='0'&&c<='9') { t=t*10+c-'0'; c=getchar(); } return t*flag;}struct node{ ll x,y;};ll cross(node a,node b,node c){ return abs((b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x));}vector<node> q;int main(){ ll n=read(),s=read(); for(int i=1;i<=n;i++) { node p; p.x=readf(),p.y=readf(); q.push_back(p); } node a,b,c; a=q[0],b=q[1],c=q[2]; ll ans=cross(a,b,c); int flag=1; while(flag) { flag=0; for(int i=0;i<q.size();i++) { ll tmp=cross(q[i],b,c); if(tmp>ans) ans=tmp,a=q[i],flag=1; tmp=cross(a,q[i],c); if(tmp>ans) ans=tmp,b=q[i],flag=1; tmp=cross(a,b,q[i]); if(tmp>ans) ans=tmp,c=q[i],flag=1; } } cout<<a.x+b.x-c.x<<" "<<a.y+b.y-c.y<<endl; cout<<a.x+c.x-b.x<<" "<<a.y+c.y-b.y<<endl; cout<<b.x+c.x-a.x<<" "<<b.y+c.y-a.y<<endl;}
阅读全文
0 0
- 最大三角形
- 最大三角形
- hdu_2202_凸包求最大三角形
- hdu 2202 最大三角形
- 最大面积三角形
- 最大周长三角形
- HDU 2202最大三角形
- HDU2202最大三角形
- 最大周长三角形问题
- 三角形最大和问题
- 最大三角形 HDU
- HDU 2022 最大三角形(点集合中最大三角形)
- HDU 2202 最大三角形(求凸包中最大三角形面积)
- poj2079凸包求最大三角形面积
- HDU 2202 求最大三角形
- hdu acm 2202 最大三角形
- 【凸包】HDU2202最大三角形
- hdu2202 最大三角形 凸包
- (3-1)Unity3D/项目:C#代码规范
- 将图像转为TFRecord文件并读取TFRecord文件
- VS2013/2012/2010 下无法打开 源 文件“stdafx.h”的解决方法
- hexo修改Next主题的样式
- PAT (Advanced Level) Practise 1055 The World's Richest (25)
- 最大三角形
- poj 1129 Channel Allocation
- HDU-4826(DP动态)
- 数据结构及算法学习(三)
- leetcode 5 Longest Palindromic Substring(1)
- ajax数据返回进行遍历
- Opencv:Microsoft C++ 异常: 内存位置 0x002af444 处的 cv::Exception
- python 函数高级特性
- C++复合类型(三)