Time Limit: 2000MS | Memory Limit: 65536KB | 64bit IO Format: %lld & %llu |
Description
Those lines divide the plane into four quadrants. The quadrant containing points with arbitrarily large positive coordinates is the top-right quadrant.
The players score according to the number of brownie points in the quadrants. If a brownie point is crossed by a line, it doesn't count. Stan gets a point for each (uncrossed) brownie point in the top-right and bottom-left quadrants. Ollie gets a point for each (uncrossed) brownie point in the top-left and bottom-right quadrants.
Your task is to compute the scores of Stan and Ollie given the point through which they draw their lines.
Input
Output
Sample Input
11 3 2 3 3 3 4 3 6 2 -2 1 -3 0 0 -3 -3 -3 -2 -3 -4 3 -7 0
Sample Output
6 3
Source
#include<cstdio>
using namespace std;
struct a
{
int x,y;
}a[200005];//结构体名可以与结构体数组名相同
int main()
{
int n,x,y,i;
int s,o;
while(scanf("%d",&n)&&n)
{
s=o=0;
for(i=0;i<n;i++)
{
scanf("%d%d",&a[i].x,&a[i].y);
}
x=a[n/2].x;
y=a[n/2].y;
for(i=0;i<n;i++)
{
if(a[i].x==x||a[i].y==y)
continue;
if(a[i].x>x&&a[i].y>y||a[i].x<x&&a[i].y<y)
s++;
else
o++;
}
printf("%d %d\n",s,o);
}
return 0;
}