首页 技术 正文
技术 2022年11月21日
0 收藏 779 点赞 2,782 浏览 1312 个字

【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

如果点的个数

【代码】

#include <bits/stdc++.h>
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
using namespace std;const double pi = acos(-1);
const int dx[4] = {0,0,1,-1};
const int dy[4] = {1,-1,0,0};
const int N = 1e5;pair<int,int> a[N+10];
vector<pair<int,int> > v;int n;bool online(int x1,int y1,int x2,int y2,int x3,int y3){
LL temp1 = 1LL*(x3-x1)*(y2-y1);
LL temp2 = 1LL*(y3-y1)*(x2-x1);
if (temp1==temp2){
return true;
}else return false;
}bool judge(int idx1,int idx2){
int x1,y1,x2,y2;
x1 = a[idx1].first,y1 = a[idx1].second,x2 = a[idx2].first,y2 = a[idx2].second;
v.clear();
for (int i = 1;i <= n;i++)
if (i!=idx1 && i!=idx2){
int x3,y3;
x3 = a[i].first,y3 = a[i].second;
if (online(x1,y1,x2,y2,x3,y3)) continue;
v.push_back(a[i]);
}
if ( (int) v.size()<=2){
return true;
}else{
x1 = v[0].first,y1 = v[0].second,x2 = v[1].first,y2 = v[1].second;
for (int i = 2;i < (int)v.size();i++){
int x3,y3;
x3 = v[i].first,y3 = v[i].second;
if (online(x1,y1,x2,y2,x3,y3)) continue;
return false;
}
return true;
}
}int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> n;
rep1(i,1,n) cin >> a[i].first >> a[i].second;
if(n<=3){
cout<<"YES"<<endl;
}else{
if (judge(1,3)||judge(1,2)||judge(2,3)) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,075
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,551
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,399
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,176
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,811
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,893