采矿

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 3899    Accepted Submission(s): 1890
Special Judge

Problem Description

某天gameboy玩魔兽RPG。有一个任务是在一个富含金矿的圆形小岛上建一个基地,以最快的速度采集完这个小岛上的所有金矿。这个小岛上有n(0<n<1000000)个金矿,每个金矿的矿藏量是相等的。而且这个小岛的地势非常平坦,所以基地可以建在小岛的任何位置,每个金矿的采矿速度只跟矿藏到基地的路程长度有关。为了不让这个任务太无聊,游戏设计者对这个小岛施了个“魔法”,规定矿工在小岛上只能正南正北正西正东走。也就是说矿工不能斜着在岛上走。

这个小岛在一个二维直角坐标系中描述。

你的任务就是帮gameboy找一个建造基地的位置,使矿工能以最快的速度采完所有矿。

 

Input

输入数据有多组。每组数据的第一行是一个正整数n(0<n<1000000),表示小岛上有n个金矿。在接下来的n行中,每行有两个实数x,y,表示其中一个金矿的坐标。n=0表示输入数据结束。
 

Output

每一组输入数据对应一行输出,输出两个实数x,y(保留小数点后两位),也就是你找到的建造基地的位置坐标。如果坐标不唯一,可以任选一个输出。
 

Sample Input

4
1.0 1.0
3.0 1.0
3.0 3.0
1.0 3.0
0
 

Sample Output

2.00
2.00
 
样例是在逗我的吗。。。
 //2016.9.22
#include <iostream>
#include <cstdio>
#include <algorithm> using namespace std; const int N = ;
double x[N], y[N]; int main()
{
int n;
while(scanf("%d", &n)!=EOF && n)
{
for(int i = ; i < n; i++)
scanf("%lf%lf", &x[i], &y[i]);
sort(x, x+n);
sort(y, y+n);
printf("%.2lf %.2lf\n", x[n/], y[n/]);
} return ;
}

HDU1173的更多相关文章

  1. hdu-1173(最短距离)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1173 思路:最短距离:就是现将x,y从小到大排序,然后去中间点就行了.(注意:本题答案不唯一) #in ...

随机推荐

  1. svn版本库通过svn://127.0.0.1/不能导出的问题解决了!!

    svn:本地file:///E:/SvnServerHome没问题,但是换为svn://192.168.1.100/SvnServerHome 报异常. 配置http协议访问svn 原文:http:/ ...

  2. spark 文件系统Alluxio(之前名为Tachyon)

    http://www.alluxio.org/documentation/v1.0.0/cn/ http://www.winseliu.com/blog/2016/04/15/alluxio-quic ...

  3. [iOS]C语言技术视频-06-程序循环结构(for{})

    下载地址: 链接: http://pan.baidu.com/s/1dD11Zwt 密码: rke9

  4. Java面向对象设计

    1.少了程序入口会在输出的地方报这个错: Syntax error, insert "... VariableDeclaratorId" to complete FormalPar ...

  5. Keil STM32调试,使用ST-Link下载程序时提示“flash timeout.reset the target and try it again”

    参考: 很郁闷,买来没多久的 STM32F4-DISCOVERY 就挂了? STM32F103RB   Jlink调试的时候出现flash timeout.reset the target and t ...

  6. STM32_IAP详解(有代码,有上位机)

    Iap,全名为in applacation programming,即在应用编程,与之相对应的叫做isp,in system programming,在系统编程,两者的不同是isp需要依靠烧写器在单片 ...

  7. vuejs 子组件传递父组件的第一种方式

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. 安卓 handler解析

    参考: 1.http://www.2cto.com/kf/201302/190591.html(安卓更新UI的两种方式,handler,Activity.runOnUIThread()) 2.http ...

  9. 输入计算表达式,将他们存在string【】中

    #include<stdio.h>#include<string>#include<string.h>#include<stdlib.h>#includ ...

  10. Swift 动态创建提示框

    var alert = UIAlertController(title: "", message: "", prefferedStyle: UIAlertCon ...