Pro.ID21607 TitleNumber Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21607 AC0 Submit0 Ratio- 时间&空间限制描述Given an equation ( a * x + b ) % n = 0, where a, b, n are positive integers, please find out the least positive integer x make that equation holds. 输入There are several test cases, one line for each case. For each line, there are three positive integers, all of which are no more than 2000000000. Input numbers have no leading zeros. There will be no more than 1000 test cases. Input is ended with three 0. 输出Description Given an equation ( a * x + b ) % n = 0, where a, b, n are positive integers, please find out the least positive integer x make that equation holds. Input There are several test cases, one line for each case. For each line, there are three positive integers, all of which are no more than 2000000000. Input numbers have no leading zeros. There will be no more than 1000 test cases. Input is ended with three 0. Output Output each result in one line. Output number must not have any leading zeros. If there is no positive integer makes the equation holds, then output -1. Sample Input 1 1 1 Sample Output 1 Source 样例输入1 1 1 样例输出1 作者 |