玲珑1052 See car

DESCRIPTION

You are the god of cars, standing at (a, b) point.There are some cars at point (xi,yi)(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>axi>a and yi>byi>b.

INPUT
There are multiple test cases.The first line is a number T (T  11 ≤11), which means the number of cases.For each case, first line has three integers a,b,n(109a,b109,0n105)a,b,n(−109≤a,b≤109,0≤n≤105).next nn lines, each line contains two integer (xi,yi)(109xi,yi109)(xi,yi)(−109≤xi,yi≤109), which means the position of car.
OUTPUT
one line --- the number of car that you can see.
SAMPLE INPUT
20 0 31 1 2 23 30 0 41 12 22 34 6
SAMPLE OUTPUT
12
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <sstream>
#include <queue>
#include <map>
using namespace std;
map<double,int> judge;
int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        judge.clear();
        long long a,b,n,i,j,x,y;
        long long res = 0;
        scanf("%lld%lld%lld",&a,&b,&n);
        for(i=1;i<=n;i++){
            scanf("%lld%lld",&x,&y);
            //cout<<(y-b)<<" "<<(x-a)<<" "<<(double)(y-b)/(x-a)<<endl;
            if(judge[(double)(y-b)/(double)(x-a)]==0){
                res++;
                judge[(double)(y-b)/(double)(x-a)]++;
            }
        }
        printf("%lld\n",res);
    }
    
    return 0;
}





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值