极角排序

 #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. mongodbOperator

    mongodb创建数据库表语句 db.createCollection("CollectionName or tableName"); db.createCollection(&q ...

  2. Git全解析之远程仓库交互

    文章目录 1. Git全解析之远程仓库交互 1.1. 中央仓库的概念 1.2. 本地分支与远程分支 1.3. pull与fetch 1.4. 关于捐赠 Git全解析之远程仓库交互 中央仓库的概念 虽然 ...

  3. error in invoking target 'mkldflags ntcontab.o nnfgt.o' of makefile

    error in invoking target 'mkldflags ntcontab.o nnfgt.o' of makefile 今天是2013-08-04,在安装oracle11g r2 数据 ...

  4. css 改变scroll样式

    /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/ ::-webkit-scrollbar { width: 16px; height: 16px; background-color: #F5 ...

  5. 浅谈MVC模式

    MVC模式(三层架构模式) (Model-View-Controller)是软件工程中的一种软件架构模式,把软件系统分为三个基本部分:模型(Model).视图(View)和控制器(Controller ...

  6. nexus私服安装

    一.搭建nexus私服.当前服务器版本是jdk1.8    . nexus安装包下载:http://www.sonatype.org/nexus/archived 先是下载目前最新的版本 Nexus ...

  7. android改动tab 导航 指示器颜色

    我事实上想改动的上面的蓝色条条,改成红色. 这个问题实在是困扰我了太长时间.之前參照google的这个文章: https://developer.android.com/training/basics ...

  8. 导出可执行的jar

    1.在你要导出的项目上单击右键,在弹出的右键菜单里选择:Export…选项. 2.在弹出的对话框里选择:,然后点击下边的Next; 3.在弹出的对话框里,点击选择导出后的jar存储路径以及文件名.(其 ...

  9. Understanding AMQP, the protocol used by RabbitMQ--reference

    RabbitMQ is a lightweight, reliable, scalable and portable message broker. But unlike many message b ...

  10. Linux下用rpm方式安装MySQL

    1.MySQL下载地址. www.mysql.com/downloads/mysql-4.0.html 下载MySQL 5.1版本的2个包(根据你的实际需求下载所需要的包): MySQL-server ...