原文鏈接:http://acm.timus.ru/problem.aspx?space=1&num=1572
背景描述:
一個井 ,形狀可能有三種: 圓形-1,正方形-2,等邊三角形-3. 邊長也會給出(input 的第一行). 接下來給出用於填補的若干石塊,
同樣的,它們的形狀也只有這三種, 但可以在空間中進行旋轉, 不考慮其厚度屬性.,可以在空間進行旋轉 n塊給出的石頭,最多有多少能夠進入?
Input
Let us denote a circle by 1, a square by 2, and a triangle by 3. This number will be the type of the figure. The size of a circle is its radius, the size of a square or triangle is the length of its
side (the sides have equal lengths). The first line contains two numbers: the type and the size of the Great Well's aperture. The second line contains an integer N, which is the number of manhole covers collected by the programmers, 1 ≤ N ≤
100. These covers are described in the next N lines: each of them contains the type and the size of a cover; the numbers are separated with a space. Sizes of all figures are integers in the range from 1 to 100.
Output
Output the number of covers that are small enough to be thrown into the Well.
Samples
input | output |
---|---|
2 10 3 3 20 1 5 2 11 |
2 |
1 5 2 2 10 1 6 |
1 |
Problem Author: Alexander Ipatov & Alex Samsonov
思路:
將空間幾何問題轉化成平面幾何, 在進入時的關鍵實際上是在比較兩個形狀的投影關係.
這個題目實際上在考察對於三類基礎形狀最短投影\最長投影的計算
圓形, 最短和最長的投影都是其直徑.
等邊三角形:
最長投影 其邊長 a
最短投影 其高 a * sqrt(3) / 2
正方形
最長投影 其對角線長 a * sqrt(2)
最短投影 其高 a
因此, 將input的所有二維點數據迭代比較, count作邏輯判斷計數.
即可.