传送门:http://codeforces.com/contest/514/problem/B
B. Han Solo and Lazer Gun
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane.

Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can destroy all the stormtroopers, situated on some line that crosses point (x0, y0).

Your task is to determine what minimum number of shots Han Solo needs to defeat all the stormtroopers.

The gun is the newest invention, it shoots very quickly and even after a very large number of shots the stormtroopers don't have enough time to realize what's happening and change their location.

Input

The first line contains three integers nx0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun.

Next n lines contain two integers each xiyi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed that no stormtrooper stands at the same point with the gun. Multiple stormtroopers can stand at the same point.

Output

Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.

Sample test(s)
input
4 0 0
1 1
2 2
2 0
-1 -1

output
2

input
2 1 2
1 1
1 0

output
1

Note

Explanation to the first and second samples from the statement, respectively

题目分析。。。eps别忘记了。。还有除0的特殊判断。。脑残了半天,除0没有判断出来

代码:

#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<set>
#include<map>
#include<vector>
#include<cstring>
#include<stack>
#include<cmath>
#include<queue>
#define INF 0x0f0f0f0f
#define eps 1e-10
using namespace std;
struct Point
{double x;double y;
};int main()
{int i,j,k,l,m,n,sum=1,flag=0;double x,y;double tana[1005];Point point[1005];scanf("%d%lf%lf",&n,&x,&y);for(i=0;i<n;i++){scanf("%lf%lf",&point[i].x,&point[i].y);}for(i=0;i<n;i++){if(fabs(point[i].x-x)>eps)tana[i]=(point[i].y-y)*1.0/(point[i].x-x);else{tana[i]=1000000000000;}}sort(tana,tana+n);for(i=1;i<n;i++){//printf("%.2lf ",tana[i]);if(tana[i]-tana[i-1]>eps)  sum++;}printf("%d\n",sum);}

Codeforces 514 B . Han Solo and Lazer Gun 精度 除0相关推荐

  1. CodeForces - 514B Han Solo and Lazer Gun

    题意: 给出N个点,和起始点X0,Y0,求N个点中有几组不同斜率与原点连接后斜率不同的点 思路: 考虑到可能出现的精度丢失,使用的分数的形式表示每个斜率,再用map去重就可以了 代码: #includ ...

  2. CF514B Han Solo and Lazer Gun

  3. Codeforces 514 D R2D2 and Droid Army(RMQ+二分法)

    An army of n droids is lined up in one row. Each droid is described by m integers a1, a2, ..., am, w ...

  4. Solo 博客系统 1.7.0 发布 - 新版 MD 编辑器

    本次发布主要是更新了 Markdown 编辑器,加入了全屏.Emoji 自动完成.粘贴时自动转换为 MD 格式的特性.(1.7.0 版本变更记录请看这里) 目前的 Markdown 编辑器有多好用呢? ...

  5. CodeForces - 1029B.Creating the Contest(最长上升子序列0(n)解法)

    思路:这道题无法用平时0(n^2)的解法来求最长上升子序列,会超时,只能用优化的最长上升子序列算法来求 You are given a problemset consisting of nn prob ...

  6. CodeForces Round #291 Div.2

    A. Chewbaсca and Number 感觉这道题巨坑,如果题中加粗标出来的输出得是正数算小坑的话.有个巨坑就是 the final number shouldn't start with a ...

  7. codeforces 514B

    题目: B. Han Solo and Lazer Gun time limit per test 1 second memory limit per test 256 megabytes input ...

  8. codeforces514

    514A. Chewbaсca and Number 大于4的就替换 开头特判 #include<cstdio> #include<cstring> #include<a ...

  9. Codeforces Gym 100463A Crossings 逆序数

    Crossings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100463 Description ...

最新文章

  1. 最全Windows下搭建go语言开发环境以及开发IDE
  2. Java数组在内存中是如何存放的
  3. json 数据 生成 图表_CAPP工艺图表 / 知识重用 快速编制
  4. vuevant移动端h5底部留白问题
  5. ClickHouse设置用户名密码
  6. njx如何实现负载均衡_负载均衡是怎么做的~
  7. JSONPath 解析 JSON 内容详解(翻译自 github)
  8. 《网络编程》守护进程
  9. 解决vSphere性能不佳的技巧
  10. Http 理论基础-请求与响应、响应状态码汇总
  11. 微信弹出遮罩层引导用户浏览器打开升级版
  12. 做了三年Java,java简历包装项目经验
  13. 计算机unity文献综述,Unity3D密室逃脱游戏设计+文献综述.doc
  14. 我是怎么打开车库门的:ASK/OOK手动解码及重放
  15. 计算机系一班班会,迎新 · 破冰会|“情暖计算机,友爱一九一”——记计算机类19-1班新生破冰班会...
  16. unnormal C++
  17. 高一下学期计算机考试知识点,高一年级信息技术期末考试复习题
  18. 易语言助手用法与方便之处
  19. Session | 基于Session改造oa项目的登录功能
  20. Python之Flask框架(一)

热门文章

  1. BAPI_GOODSMVT_CREATE MIGO预留成本中心201发货实例
  2. 高数-不定积分--凑积分(第一类换元法)
  3. BPR:面向隐偏好数据的贝叶斯个性化排序学习模型
  4. 21日活动议程和场地乘车路线
  5. 移动硬盘无法读取怎么修复?
  6. redis redisson 分布式锁 WRONGTYPE Operation against a key holding the wrong kind of value
  7. Android拾遗——如何反编绎APK文件
  8. 人渣!鄂尔多斯一男子发布前女友裸照,被警方拘留!
  9. 开源资产管理系统_使用ThinkPHP能够开发那些管理系统
  10. unity接入微信支付完成切换前台游戏闪退