Alignment of the Planets
来源:互联网 发布:alphago 算法 编辑:程序博客网 时间:2024/05/16 19:54
时限:1000ms 内存限制:10000K 总时限:3000ms
描述:
Actually, this problem is about alignment of N (1 <= N <= 770) cows numbered 1..N who are grazing in their field that is about 15,000x15,000 units. Their grazing locations all fall on integer coordinates in a standard x,y scheme (coordinates are in the range 0..15,000).
Bessie looks up and notices that she is exactly lined up with Sara and Julie. She wonders how many groups of three aligned cows exist within the field.
Given the locations of all the cows (no two cows occupy the same location), figure out all sets of three cows are exactly collinear. Keep track of the sets, sorting the cows in each set by their ID number, lowest first. Then sort the sets by the three ID numbers (lowest first), breaking ties by examining the second and third ID numbers.
输入:
Line 1: A single integer, N
Lines 2..N+1: Line i+1 describes cow i's location with two space-separated integers that are her x and y coordinates
输出:
Line 1: A single integer that is the number of sets of three cows that are exactly collinear. A set of four collinear cows would, of course, result in four sets of three collinear cows.
Lines 2..?: Each line contains three space-separated integers that are the cow ID numbers of three collinear cows. The lines are sorted as specified above. This output section is empty if no collinear sets exist.
输入样例:
8
0 0
0 4
1 2
2 4
4 3
4 5
5 1
6 5
输出样例:
1
1 3 4
提示:
Be careful of floating point arithmetic. Floating point comparison for equality almost never works as well as one would hope.
Explanation of the sample:
Eight cows grazing on a grid whose lower left corner looks like this:
. . . . * . *
* . * . . . .
. . . . * . .
. * . . . . .
. . . . . * .
* . . . . . .
The digits mark the collinear cow IDs:
. . . . * . *
* . 4 . . . .
. . . . * . .
. 3 . . . . .
. . . . . * .
1 . . . . . .
- Alignment of the Planets
- Alignment of the Planets
- POJ 3174 Alignment of the Planets
- POJ 3174 Alignment of the Planets
- POJ 3174 Alignment of the Planets 笔记
- 结构体对齐(The alignment of structure)
- How to set the title of UIButton as left alignment?
- What are the meaning of the items in the “alignment trap” error message?
- Alignment of structure
- UVA1593 - Alignment of Code
- 1593 - Alignment of Code
- 1593 - Alignment of Code
- UVa1593 - Alignment of Code
- UVA_1593: Alignment of Code
- Uva Alignment of Code
- Uva1593 Alignment of Code
- Alignment of Code UVA
- Alignment of Code
- [Error]'fopen'This function or variable may be unsafe
- .net 服务器端缓存与客户端缓存
- 简单的引导程序
- ACM常用算法及其相应的练习题
- C#命名规则
- Alignment of the Planets
- getrusage
- C语言数据类型概要图
- C#实现快捷键(系统热键)响应
- 80x86通用寄存器
- 城堡
- 右键菜单
- C#中利用存储过程(含有参数)返回dataset
- 在 Linux 上找出并解决程序错误的主要方法