Discrete Logging

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=14&page=show_problem&problem=1166 [PDF](https://uva.onlinejudge.org/external/102/p10225.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10225/8f3c646876319e7077dcca889242cfa7bc79674d.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10225/f80b0cc11b35bd1a4af14fefb9512966c93efe2c.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10225/7997482b668d371df1eef9a909e7fd16f82c356a.png)

输入输出样例

输入样例 #1

5 2 1
5 2 2
5 2 3
5 2 4
5 3 1
5 3 2
5 3 3
5 3 4
5 4 1
5 4 2
5 4 3
5 4 4
12345701 2 1111111
1111111121 65537 1111111111

输出样例 #1

0
1
3
2
0
3
1
2
0
no solution
no solution
1
9584351
462803587