极角排序

 #include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define maxn 30000
using namespace std; struct point
{
double x,y;
int num;
}p[maxn];
point pp;
double cross(const point &a,const point &b,const point &c)
{
return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);
}
bool cmp(const point &a,const point &b)
{
if(cross(p[],a,b)>) return ;
else return ;
}
int main()
{
int n;
int k=;
scanf("%d",&n);
for(int i=; i<n; i++)
{
scanf("%lf%lf",&p[i].x,&p[i].y);
p[i].num=i+;
if(p[i].y<p[k].y||(p[k].y==p[i].y&&p[i].x<p[k].x)) k=i;
}
swap(p[],p[k]);
sort(p+,p+n,cmp);
printf("%d %d\n",p[].num,p[n/].num);
return ;
}

ural 1207 Median on the Plane的更多相关文章

  1. ural 1306. Sequence Median

    1306. Sequence Median Time limit: 1.0 secondMemory limit: 1 MBLanguage limit: C, C++, Pascal Given a ...

  2. URAL 1306 Sequence Median(优先队列)

    题意:求一串数字里的中位数.内存为1M.每个数范围是0到2的31次方-1. 思路:很容易想到把数字全部读入,然后排序,但是会超内存.用计数排序但是数又太大.由于我们只需要第n/2.n/2+1大(n为偶 ...

  3. URAL 1306 - Sequence Median 小内存求中位数

    [题意]给出n(1~250000)个数(int以内),求中位数 [题解]一开始直接sort,发现MLE,才发现内存限制1024k,那么就不能开int[250000]的数组了(4*250000=1,00 ...

  4. Applying vector median filter on RGB image based on matlab

    前言: 最近想看看矢量中值滤波(Vector median filter, VMF)在GRB图像上的滤波效果,意外的是找了一大圈却发现网上没有现成的code,所以通过matab亲自实现了一个,需要学习 ...

  5. ural 1246. Tethered Dog

    1246. Tethered Dog Time limit: 1.0 secondMemory limit: 64 MB A dog is tethered to a pole with a rope ...

  6. Ural 2036. Intersect Until You're Sick of It 计算几何

    2036. Intersect Until You're Sick of It 题目连接: http://acm.timus.ru/problem.aspx?space=1&num=2036 ...

  7. Ural State University Internal Contest October'2000 Junior Session

    POJ 上的一套水题,哈哈~~~,最后一题很恶心,不想写了~~~ Rope Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7 ...

  8. URAL 2036 Intersect Until You're Sick of It 形成点的个数 next_permutation()函数

    A - Intersect Until You're Sick of It Time Limit:500MS     Memory Limit:65536KB     64bit IO Format: ...

  9. No.004:Median of Two Sorted Arrays

    问题: There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the ...

随机推荐

  1. flash 中无法导出swf文件的解决方法

    近一个星期,我的flash cs6一直导不出swf文件,郁闷了好长时间,今天终于在网上找到了解决办法:总结了一下,如下:      一.是把文字打散,变成形状.      二.是把汉字的字体设成fla ...

  2. Byte[]、Image、Bitmap_之间的相互转换

    1.将图片Image转换成Byte[] /// <summary>        /// 将图片Image转换成Byte[]        /// </summary>     ...

  3. JavaScript 构造函数

    关于JavaScript构造函数,如今出现了很多JavaScript的框架,例如jQuery.Ext等等这些,这些将JavaScript作为一种面向对象的语言进行编程,那么JavaScript到底是怎 ...

  4. UGUI的9个重要回调函数

    using UnityEngine; using System.Collections; using UnityEngine.EventSystems; //句柄 public class Butto ...

  5. 经典C面试题

    12个有趣的C语言面试题 面试题C 摘要:12个C语言面试题,涉及指针.进程.运算.结构体.函数.内存,看看你能做出几个! 1.gets()函数 问:请找出以下代码里的问题: #include< ...

  6. 使用正则表达式给网址添加a标签

    在内容中存在链接地址的时候,我们在前台显示时一定想自动的将地址添加上a标签,方便用户进入链接.使用正则表达式就能轻松实现. Jsvascript正则替换 //javascript 正则替换 var s ...

  7. Android 快速开发系列 打造万能的ListView GridView 适配器

    转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/38902805 ,本文出自[张鸿洋的博客] 1.概述 相信做Android开发的写 ...

  8. oracle手动删除数据库

    有时候,无法使用图形界面时,我们需要手动删除数据库,具体操作步骤如下:一.手动删除文件系统数据库   1.停止监听,防止有新的连接产生,同时,在数据库配置了em的,也需要停止 $ lsnrctl st ...

  9. 刚接触js感觉好吃力啊

    我是一个新手,最近刚刚开始学习js这门语言,感觉好难,有一种无从下手的感觉,不知道应该从哪里学习,虽然也看了很多的书,但是对于一个没有计算机基础的人来说,真的是一种煎熬,每一个名词都要去查.万事开头难 ...

  10. 纯 CSS 创建各种不同的图形形状

    使用代码 矩形 .rectangle { width: 250px; height: 150px; background-color: #6DC75F; } <div></div&g ...