#P2485. [SDOI2011] 计算器
[SDOI2011] 计算器
Description
You are asked to design a calculator to complete the following three tasks:
- Given , compute the value of .
- Given , compute the smallest non-negative integer such that .
- Given , compute the smallest non-negative integer such that .
Do your best to win the prize!
Input Format
The input contains multiple test cases.
The first line contains two positive integers , denoting the number of test cases and the query type, respectively (for all testdata within a single test point, the query type is the same).
Each of the following lines contains three positive integers , describing one query.
Output Format
The output contains lines.
For each query, output one line with the answer.
For query types and , if no solution exists, output Orz, I cannot find x!.
3 1
2 1 3
2 2 3
2 3 3
2
1
2
3 2
2 1 3
2 2 3
2 3 3
2
1
0
4 3
2 1 3
2 2 3
2 3 3
2 4 3
0
1
Orz, I cannot find x!
0
Hint
Test points are divided into three categories. The proportion of each category among all test points is as follows:
| Proportion of test points | |
|---|---|
All testdata satisfy: , is prime, and .
Translated by ChatGPT 5
京公网安备 11011102002149号