#P3081. [USACO13MAR] Hill Walk G
[USACO13MAR] Hill Walk G
Description
There are hills (). Each hill is a line segment from to with and . No two segments intersect or touch, even at their endpoints. The first hill satisfies .
Bessie the cow starts at on the first hill. While on a hill, she climbs up until she reaches the end, then she jumps off the edge. She falls straight down at a fixed . If she lands on another hill, she continues walking on that hill; otherwise, she keeps falling until she lands safely at .
Each hill contains the point but does not contain the point . Therefore, Bessie will land on the hill if she falls on it from above at , but she will not land on the hill if she falls on it from above at .
Please count the total number of hills that Bessie touches at some point during her walk.
Input Format
- Line 1: The number of hills, .
- Lines 2..: Line contains four integers describing hill . Each integer is in the range .
Output Format
- Line 1: The number of hills Bessie touches on her journey.
4
0 0 5 6
1 0 2 1
7 2 8 5
3 0 7 7
3
Hint
There are four hills. The first hill runs from to , and so on. Bessie walks on hills #1, #4, and finally #3.
Translated by ChatGPT 5
京公网安备 11011102002149号