Piltover and Zaun
InterviewTime limit1sMemory limit1024 MB
Given current statuses x1 and x2 and n years, decide whether Piltover gaining and Zaun losing the same yearly amounts can produce them.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Statement
Some people like to think that Piltover and Zaun are two cities that are completely opposite to each other. Sometimes these comparisons go to absurd extremes.
For example, as children, Vi and Powder heard a story that Piltover and Zaun were almost identical cities at first, with the same integer status value . Then, year by year, they drifted apart: in year , the status of Piltover rose by an integer , while the status of Zaun fell by the same .
According to this version of the story, years have passed since the two paths split. So the status of Piltover rose by , and the status of Zaun fell by the same amount.
You are given the current status values of the two cities and the number of years . Determine whether this history could have happened, that is, whether there exist and such that the current statuses could have been produced as described above. If not, the story is made up.
Input
A single line contains three integers , , and , separated by spaces. These are the current status of Piltover, the current status of Zaun, and the number of years since the first change in status ().
The value means that the status has not changed yet.
Output
Print YES if the history could be true and the current statuses can be obtained as described, and NO otherwise.