ural 2067 Friends and Berries 数学推理
来源:互联网 发布:淘宝带图评价 淘气值 编辑:程序博客网 时间:2024/06/12 23:19
熟悉的数学定理 两边之和大于第三边 必然被不成三角形,而且是对于每一个点,都要有这样的结论,所以先排序然后所有的点都在同一边上即可
#include <bits/stdc++.h>using namespace std;struct node{ int x,y; int id;}s[301010];int cmp(node a,node b){ if(a.x==b.x) return a.y<b.y; return a.x<b.x;}int main(){ int n; cin>>n; int tot=0; for(int i=0;i<n;i++) { scanf("%d%d",&s[i].x,&s[i].y); s[i].id=i+1; } sort(s,s+n,cmp); int ok=0; for(int i=1;i<n-1;i++) { if(abs(s[i].x-s[0].x)*abs(s[n-1].y-s[i].y)!=abs(s[i].y-s[0].y)*abs(s[n-1].x-s[i].x)) { ok=1;break;} } if(ok==0) { printf("1\n"); printf("%d %d\n",s[0].id,s[n-1].id ); } else printf("0\n");}
0 0
- ural 2067 Friends and Berries 数学推理
- URAL 2067 Friends and Berries
- Ural 2067 Friends and Berries 【思维】
- URAL 2067. Friends and Berries
- URAL 2001. Mathematicians and Berries
- URAL 2001 Mathematicians and Berries (小学数学题)
- URAL 2025. Line Fighting 简单数学推理
- CodeForces258C Little Elephant and LCM(数学推理)
- CodeForces515B Drazil and His Happy Friends (数学)
- URAL 2067-数学
- URAL 1200. Horns and Hoofs 枚举+数学
- URAL 1981. Parallel and Perpendicular(数学 )
- Codeforces Round #275(Div2) B.Friends and Presents 二分+数学
- Codeforces #361D. Friends and Subsequences 数学 尺取法
- HDU2552 三足鼎立 【数学推理】
- hdu 5399(数学推理)
- An easy problem+数学推理
- HDU4666 Hyperspace(数学推理+数据结构)
- 配置环境变量
- MIT的《深度学习》精读(8)
- Android从零单排--常见设计模式
- qml之StackView
- 简单的方法实现文件下载
- ural 2067 Friends and Berries 数学推理
- windbg的!runaway命令
- matlab c# 混合编程笔记
- WPA认证过程
- Vijos 1144 小胖守皇宫 【树形DP】
- Freemarker 使用
- jdbc自动生成实体类
- poj2528Mayor's posters【离散化+线段树】
- Ionic使用cordova-hot-code-push实现热更新