链接:井枯旋
题意很简单,给你奇数个点,中间一个点为中心点,也可以说是原点,这样,就有了四个象限,左上,右下象限的点的个数为O的得分,右上,左下象限的点的个数为S的得分,最后输出得分就可以了。连排序都不需要。。。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
struct x
{
int x, y;
} point[200000];
int main()
{
int n;
while(scanf("%d", &n) != EOF && n)
{
for(int i = 0; i < n; i++)
scanf("%d%d", &point[i].x, &point[i].y);
int cent = n / 2;
int cx = point[cent].x, cy = point[cent].y;
int s = 0, o = 0;
for(int i = 0; i < n; i++)
{
if(point[i].x < cx && point[i].y > cy)
o++;
if(point[i].x > cx && point[i].y > cy)
s++;
if(point[i].x < cx && point[i].y < cy)
s++;
if(point[i].x > cx && point[i].y < cy)
o++;
}
printf("%d %d\n", s, o);
}
return 0;
}