#P3846. 【模板】BSGS / [TJOI2007] 可爱的质数
【模板】BSGS / [TJOI2007] 可爱的质数
Description
Given a prime , an integer , and an integer , compute the smallest non-negative integer such that .
Input Format
A single line contains integers, representing in order.
Output Format
A single line. If there exists an satisfying the requirement, output the smallest ; otherwise output no solution.
5 2 3
3
Hint
Constraints
- For all testdata, it is guaranteed that , .
Translated by ChatGPT 5
京公网安备 11011102002149号