玲珑学院 1052 - See car

Posted 十年换你一句好久不见

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了玲珑学院 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;
}

 

以上是关于玲珑学院 1052 - See car的主要内容,如果未能解决你的问题,请参考以下文章

玲珑学院 1127 咸鱼文章

玲珑学院 1050 - array

玲珑学院 1149 - Buildings

玲珑学院 1128 咸鱼拷问

玲珑学院 1138 - 震惊,99%+的中国人都会算错的问题

玲珑学院OJ 1028 - Bob and Alice are playing numbers 字典树,dp