码迷,mamicode.com
首页 > 其他好文 > 详细

玲珑学院 1052 - See car

时间:2017-07-22 11:06:00      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:tput   cti   relative   hat   -o   position   padding   images   algorithm   

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

标签:tput   cti   relative   hat   -o   position   padding   images   algorithm   

原文地址:http://www.cnblogs.com/shinianhuanniyijuhaojiubujian/p/7220362.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!