MOD - Power Modulo Inverted
题意翻译
求最小的$y$使得$k ≡ x^y (mod \ z)$
无解输出"No Solution"
$k,y,x\in[1,10^9]$
translated by yler
题目描述
Given 3 positive integers _x_, _y_ and _z_, you can find _k = x $ ^{y} $ %z_ easily, by fast power-modulo algorithm. Now your task is the inverse of this algorithm. Given 3 positive integers _x_, _z_ and _k_, find the smallest non-negative integer _y_, such that _k%z = x $ ^{y} $ %z_.
输入输出格式
输入格式
About 600 test cases.
Each test case contains one line with 3 integers _x_, _z_ and _k_.(1<= _x_, _z_, _k_ <=10 $ ^{9} $ )
Input terminates by three zeroes.
输出格式
For each test case, output one line with the answer, or "No Solution"(without quotes) if such an integer doesn't exist.
输入输出样例
输入样例 #1
5 58 33
2 4 3
0 0 0
输出样例 #1
9
No Solution