ural 2067. Friends and Berries
2067. Friends and Berries
Memory limit: 64 MB
Input
Output
Samples
| input | output |
|---|---|
2 |
1 |
3 |
0 |
Problem Source: Ural Regional School Programming Contest 2015
#include <iostream>
#include <cstdio>
using namespace std;
#define INF (1000000001) const int N = ;
int n;
typedef long long LL;
struct Point
{
LL x, y;
} arr[N]; inline void input()
{
cin >> n;
for(int i = ; i <= n; i++)
cin >> arr[i].x >> arr[i].y;
} inline LL multi(Point o, Point a, Point b)
{
return (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
} inline void solve()
{
for(int i = ; i <= n; i++)
if(multi(arr[], arr[], arr[i]) != )
{
cout << << "\n";
return;
} int x = , y = ;
for(int i = ; i <= n; i++)
{
if(arr[i].x < arr[x].x || (arr[i].x == arr[x].x && arr[i].y < arr[x].y)) x = i;
if(arr[i].x > arr[y].x || (arr[i].x == arr[y].x && arr[i].y > arr[y].y)) y = i;
}
cout << << "\n";
cout << x << " " << y << "\n";
} int main()
{
ios::sync_with_stdio();
input();
solve();
return ;
}
ural 2067. Friends and Berries的更多相关文章
- URAL 2067 Friends and Berries (推理,数学)
题意:给定 n 个人,每个人两个值s, r,要满足,p(v, u) = sqrt((sv − su)^2 + (rv − ru)^2), p(v,u,w) = (p(v,u) + p(v,w) + p ...
- Friends and Berries URAL - 2067 (计算三点共线和计算的时候的注意点)
题目链接:https://cn.vjudge.net/problem/URAL-2067 具体思路:判断三点共线就可以了,只有一对点能满足,如果一对就没有那就没有满足的. 在计算的时候,要注意,如果是 ...
- 福利到!Rafy(原OEA)领域实体框架 2.22.2067 发布!
距离“上次框架完整发布”已经过去了一年半了,应群中的朋友要求,决定在国庆放假之际,把最新的框架发布出来,并把帮助文档整理出来,这样可以方便大家快速上手. 发布内容 注意,本次发布,只包含 Rafy ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
- ural 2069. Hard Rock
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...
- ural 2068. Game of Nuts
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...
随机推荐
- 第二章 C#基本数据类型
第一节 1-关键字和标识符关键字:会不同颜色显示标示符:由字母.中文.数字.下划线组成,不能以数字开头,不能是关键字,不能含有特殊符号,如:@,$思考:下列哪些是合法的标识符?a1.1a.a_b._1 ...
- CROSS JOIN连接用于生成两张表的笛卡尔集
将两张表的情况全部列举出来 结果表: 列= 原表列数相加 行= 原表行数相乘 CROSS JOIN连接用于生成两张表的笛卡尔集. 在sql中cross join的使用: 1.返回的记录数为两个 ...
- ios 弹出键盘 视图向上平移
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardwillAppear:) name:U ...
- Struts2拦截器之ModelDrivenInterceptor
叙述套路: 1.这是个啥东西,它是干嘛用的? 2.我知道它能干啥了,那它咋个用呢? 3.它能跑起来了,但是它是咋跑起来的是啥原理呢? 一.ModelDriven是个啥?他能做什么? 从前端页面到后端的 ...
- 三、jQuery--jQuery实践--瀑布流布局
实现方法: 1.JavaScript 2.jQuery 3.CSS多栏布局 法一: window.onload=function(){ waterfall('main','pin'); var dat ...
- mysql编码设置
一:mysql字符集 mysql的字符集支持(Character Set Support)有两个类型:字符集(Character set)和连接校对(Collation).对于字符集的支持细化到四个层 ...
- IIS网站发布若干问题
1.Win7 64位 IIS未能加载文件或程序集"System.Data.SQLite"或它的某一个依赖项 未能加载文件或程序集"System.Data.SQLite ...
- GPS NEMA 0183协议
转自:http://www.cnblogs.com/xidongs/archive/2011/02/01/1948689.html 一. NMEA0183标准语句(GPS常用语句)$GPGGA例:$G ...
- Quartz:Cron Expressions
原文地址:http://www.quartz-scheduler.net/documentation/quartz-2.x/tutorial/crontrigger.html 注意: 位也可能是7位, ...
- 用康托展开实现全排列(STL、itertools)
康拓展开: $X=a_n*(n-1)!+a_{n-1}*(n-2)!+\ldots +a_2*1!+a_1*0!$ X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+ ...