HDU 1173

采矿
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 5144 Accepted Submission(s): 2398
Special Judge

Problem Description
某天gameboy玩魔兽RPG。有一个任务是在一个富含金矿的圆形小岛上建一个基地,以最快的速度采集完这个小岛上的所有金矿。这个小岛上有n(0

#include<cstdio>
#include<algorithm>
using namespace std;

float a[1000050], b[1000050];

int main()
{
    int n;
    while (scanf ("%d", &n) && n)
    {
        int i;
        for (i = 1; i <= n; i++)
            scanf ("%f %f", &a[i], &b[i]);
        sort (a, a+n+1);
        sort (b, b+n+1);
        if (n % 2 == 0)
            printf("%.2f %.2f\n", (a[n/2] + a[n/2 + 1])/2, (b[n/2] + b[n/2 + 1])/2);
        else
            printf("%.2f %.2f\n", a[(n+1)/2], b[(n+1)/2]);
    }
    return 0;
 } 

猜你喜欢

转载自blog.csdn.net/hqzzbh/article/details/81067540