#P4195. 【模板】扩展 BSGS / exBSGS
【模板】扩展 BSGS / exBSGS
Description
Given , find the smallest non-negative integer such that .
Input Format
Each test file contains several test cases, with the guarantee that .
Each test case consists of one line with positive integers .
When , it indicates the end of input.
Output Format
For each test case, output one line.
If there is no solution, output No Solution. Otherwise, output the smallest non-negative integer solution.
5 58 33
2 4 3
0 0 0
9
No Solution
Hint
For of the testdata, or .
2021/5/14 strengthened by SSerxhs.
2021/7/1 added a set of hack testdata.
Translated by ChatGPT 5
京公网安备 11011102002149号