Try Again

玲珑学院 1052 - See car

1052 - See car

Time Limit:2s Memory Limit:64MByte

Submissions:594Solved:227

DESCRIPTION

You are the god of cars, standing at (a, b) point.There are some cars at point (xi,yi),

. If lots of cars and you are in one line, you can only see the car that is nearest to yourself. How many cars can you see?
It is guaranteed that xi>a && yi>b;

, which means the position of car.
OUTPUT
one line --- the number of car that you can see.
SAMPLE INPUT
2
0 0 3
1 1
2 2
3 3
0 0 4
1 1
2 2
2 3
4 6
SAMPLE OUTPUT
1
2
set的简单应用,去重
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
int a,b,n,t,x,y;
set<double>s;
int main()
{
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%d%d",&a,&b,&n);
        for(int i=1;i<=n;i++)
        {
            scanf("%d%d",&x,&y);
            double k=((y-b)*1.0)/((x-a)*1.0);
            s.insert(k);
        }
        printf("%d\n",s.size());
        s.clear();
    }
    return 0;
}

 

posted @ 2017-07-22 09:30  十年换你一句好久不见  阅读(224)  评论(0编辑  收藏  举报