P5515 [MtOI2019] Reimu's Calculator.

Background

**Note: This background is adapted from a real event where disangan233 bought a calculator before the high school entrance exam.** After Hakurei Reimu successfully took back the donation money that Yakumo Yukari stole using gaps, she and Yorigami Shion went to Kourindou to buy things! Reimu wanted to buy a calculator to compute the shrine’s donation money, but since the goods in Kourindou were too expensive, she chose to buy a Casio calculator online via Kawashiro Nitori's Network (KNN). Unexpectedly, the Casio she bought through KNN was a fake. It can display only the integer part (i.e., it always rounds down). Reimu is troubled, because this calculator may cause some especially large errors. So Reimu wants you, who have a shikigami from the Outside World (meaning a computer), to help her solve a problem.

Description

Reimu is given 3 real numbers $n$, $a$, $b$ ($4 \le n \le 5$, $5 \le a,b \le 10$). She successfully computed $n^a+n^b$, and got a result that shows only the integer part on the calculator. Reimu wants to know: if there exists a real number $n'(n' \geq 0)$ such that the result of ${n'}^a+{n'}^b$ shown on the calculator is **exactly the same** as the result shown for $n^a+n^b$, then what is the range of possible values of $n'$, i.e., the difference between the maximum and minimum possible $n'$. If you do not know how to compute $n^k$, please use the `pow()` function in the `cmath` library. The result of `pow(n,k)` is $n^k$. --- To increase the difficulty of this problem, Reimu gives you $T$ queries. To reduce your input and output to some extent, we generate the queries using the following code (the code comes from Kawashiro Heavy Industries): ~~~cpp namespace Mker { // Powered By Kawashiro_Nitori // Made In Gensokyo, Nihon #define uint unsigned int uint sd;int op; inline void init() {scanf("%u %d", &sd, &op);} inline uint uint_rand() { sd ^= sd > 7; sd ^= sd

Input Format

The input contains one line with $3$ positive integers $T$, $seed$, $op$. Their meanings are described in the problem statement.

Output Format

Output one line, the answer required in the problem statement.

Explanation/Hint

### Subtasks ![QQ图片20190707214000.png](https://i.loli.net/2019/07/07/5d21f64bc09c827059.png) ### Source [Lost House 2019 League](https://www.luogu.org/contest/20135) (MtOI2019) T2 Problem setter: disangan233 Problem reviewer: suwakow Translated by ChatGPT 5