题目传送门

 /*
水题,就是用三点共线的式子来判断射击次数
*/
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std; const int MAXN = 1e3 + ;
int x[MAXN], y[MAXN];
bool used[MAXN]; int main(void)
{
//freopen ("B.in", "r", stdin); int n, x0, y0; while (~scanf ("%d%d%d", &n, &x0, &y0))
{
memset (used, , sizeof (used)); for (int i=; i<=n; ++i)
{
scanf ("%d%d", &x[i], &y[i]);
x[i] -= x0; y[i] -= y0;
} int cnt = ;
for (int i=; i<=n; ++i)
{
if (!used[i])
{
cnt++;
for (int j=i; j<=n; ++j)
{
if (!used[j] && (x[i] * y[j] == x[j] * y[i]))
used[j] = ;
}
}
} printf ("%d\n", cnt);
} return ;
}

数学 Codeforces Round #291 (Div. 2) B. Han Solo and Lazer Gun的更多相关文章

  1. Codeforces Round #291 (Div. 2) B. Han Solo and Lazer Gun

    因为是x,y均为整数因此对于同一直线的点,其最简分数x/y是相同的(y可以为0,这里不做除法)于是将这些点不断求最简分数用pair在set中去重即可. #include <cmath> # ...

  2. hash+set Codeforces Round #291 (Div. 2) C. Watto and Mechanism

    题目传送门 /* hash+set:首先把各个字符串的哈希值保存在set容器里,然后对于查询的每一个字符串的每一位进行枚举 用set的find函数查找是否存在替换后的字符串,理解后并不难.另外,我想用 ...

  3. 贪心/数学 Codeforces Round #212 (Div. 2) A. Two Semiknights Meet

    题目传送门 /* 贪心/数学:还以为是BFS,其实x1 + 4 * k = x2, y1 + 4 * l = y2 */ #include <cstdio> #include <al ...

  4. 数学 Codeforces Round #219 (Div. 2) B. Making Sequences is Fun

    题目传送门 /* 数学:这题一直WA在13组上,看了数据才知道是计算cost时超long long了 另外不足一个区间的直接计算个数就可以了 */ #include <cstdio> #i ...

  5. 数学 Codeforces Round #308 (Div. 2) B. Vanya and Books

    题目传送门 /* 水题:求总数字个数,开long long竟然莫名其妙WA了几次,也没改啥又对了:) */ #include <cstdio> #include <iostream& ...

  6. 数学 Codeforces Round #282 (Div. 2) B. Modular Equations

    题目传送门 题意:a % x == b,求符合条件的x有几个 数学:等式转换为:a == nx + b,那么设k = nx = a - b,易得k的约数(>b)的都符合条件,比如a=25 b=1 ...

  7. 暴力/set Codeforces Round #291 (Div. 2) C. Watto and Mechanism

    题目传送门 /* set的二分查找 如果数据规模小的话可以用O(n^2)的暴力想法 否则就只好一个一个的换(a, b, c),在set容器找相匹配的 */ #include <cstdio> ...

  8. 贪心/字符串处理 Codeforces Round #291 (Div. 2) A. Chewbaсca and Number

    题目传送门 /* WA了好几次,除了第一次不知道string不用'\0'外 都是欠考虑造成的 */ #include <cstdio> #include <cmath> #in ...

  9. Codeforces Round #291 (Div. 2)

    A 题意:给出变换规则,单个数字t可以变成9-t,然后给出一个数,问最小能够变成多少. 自己做的时候理解成了不能输出前导0,但是题目的本意是不能有前导0(即最高位不能是0,其余位数按照规则就好) 55 ...

随机推荐

  1. zoj.3868.GCD Expectation(数学推导>>容斥原理)

    GCD Expectation Time Limit: 4 Seconds                                     Memory Limit: 262144 KB    ...

  2. 淘宝(阿里百川)手机客户端开发日记第七篇 Service,Handler和Thread

    现在我们已经已经知道android有Service,Handler和Thread这些内容了,但是我想应该还有很多人对此并不是很清楚他们之间的区别! (1)Service 是运行在后端的程序,不与UI直 ...

  3. UIImageView 动画 / UIImage 方向

    UIImage 方向 UIImage imageOrientation是相对当前屏幕的横竖屏来判断方向 如果本身是横屏, 照片也是横屏的话, 方向是正方向 BOOL b1 = (originalIma ...

  4. 删除右键ATI CATALYST(R) Control Center的方法

    http://share.weiyun.com/c47530d3e44ea15b606d4ba6f1b00a28

  5. sharepoint部件webparth关闭找回的方法

  6. Python OpenSource Project

    http://www.oschina.net/project/lang/25/python

  7. 浅谈mysql集群

    一.什么是MySQL集群 MySQL集群是一个无共享的(shared-nothing).分布式节点架构的存储方案,其目的是提供容错性和高性能. 数据更新使用读已提交隔离级别(read-committe ...

  8. 在SQLServer处理中的一些问题及解决方法 NEWSEQUENTIALID()

    一.DBLINK性能问题select * from dbsource.dbname.dbo.table where guid in (select guid from tablechangelog w ...

  9. Could not create the view: An unexpected exception was thrown. 电脑突然断电,myeclipse非正常关闭,出现错误

    电脑突然断电,myeclipse非正常关闭,“Package Explorer”非正常显示,出现错误“Could not create the view: An unexpected exceptio ...

  10. HTML基础2 表单和框架

    表单: <form id="" name="" method="post/get" action"负责处理的服务端" ...