Intersections
Time limit1sMemory limit512 MB
Count the intersection points of the piecewise triangular wave f(x) with the line g(x) = x/a, or report that there are infinitely many.
- Level
Medium7 of 10
- Topics
- Math, Implementation, Brute force, Geometry
- Solved
- No attempts yet
Problem
You are given the following two functions. ( denotes the set of non-negative integers.)
How many points do the graphs of and have in common on the XY-plane?
Input
The first and only line of the input contains a single integer .
Output
Print the number of points where the graphs of and intersect. If there are infinitely many, print INF.
Constraints
- ;
- is an integer.