Age Expression
Time limit5sMemory limit1024 MB
Given Dr. O's age N and the ages A and K of his granddaughters, decide whether positive integers a and k satisfy a*A + k*K = N.
- Level
Easy2 of 10
- Topics
- Brute force, Math
- Solved
- No attempts yet
Problem
Dr. O has two granddaughters, Alyssa and Konari, and they keep Dr. O young!
When people ask Dr. O how old he is, Dr. O does not give one positive integer (his age). Instead, Dr. O gives two positive integers and . Dr. O's age is then computed as .
Given three positive integers (Dr. O's age, Alyssa's age, and Konari's age), determine whether positive integers and exist.
Input
There is one input line with three integers, in order: Dr. O's age, Alyssa's age, and Konari's age. It is given that Konari's age Alyssa's age Dr. O's age .
Output
Print 1 if and exist, and 0 otherwise. Note that and must both be greater than zero.