Clever Y
Time Limit: 5000MS
Memory Limit: 65536K
Total Submissions: 6195
Accepted: 1500
Description
Little Y finds there is a very interesting formula in mathematics:
XY mod Z = K
Given X, Y, Z, we all know how to figure outK fast. However, given
X, Z, K, could you figure outY fast?
Input
Input data consists of no more than 20 test cases. For each test case, there would be only one line containing 3 integers
X,
Z,
K (0 ≤
X,
Z,
K ≤ 10
9).
Input file ends with 3 zeros separated by spaces.
Output
For each test case output one line. Write "No Solution" (without quotes) if you cannot find a feasible
Y (0 ≤
Y <
Z). Otherwise output the minimum
Y you find.
Sample Input
5 58 33
2 4 3
0 0 0
Sample Output
9
No Solution
模板題,測試模板
代碼:
/* ***********************************************
Author :rabbit
Created Time :2014/4/2 21:01:29
File Name :7.cpp
************************************************ */
#pragma comment(linker, "/STACK:102400000,102400000")
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include