Earthquake
Time limit1sMemory limit128 MB
Count the integer points (x,y) with x≥0, y≥0 and Ax+By≤C for given positive A, B, C.
- Level
Medium6 of 10
- Topics
- Math, Number theory, Geometry
- Solved
- No attempts yet
Problem
Infinity City occupies an infinite quarter-plane: at every point with integer coordinates and there stands exactly one skyscraper, so the city contains infinitely many of them.
One day an earthquake tore a long crack along the line . Every skyscraper standing at a point with collapsed and vanished, leaving only the skyscrapers with . The city has become finite. Count how many skyscrapers remain.
Input
A single line contains three space-separated positive integers , , and , where and .
Output
Print a single integer: the number of skyscrapers that remain in the city.