#P5515. [MtOI2019] 灵梦的计算器
[MtOI2019] 灵梦的计算器
Description
Reimu is given 3 real numbers , , (, ). She successfully computed , and got a result that shows only the integer part on the calculator.
Reimu wants to know: if there exists a real number such that the result of shown on the calculator is exactly the same as the result shown for , then what is the range of possible values of , i.e., the difference between the maximum and minimum possible .
If you do not know how to compute , please use the pow() function in the cmath library. The result of pow(n,k) is .
To increase the difficulty of this problem, Reimu gives you 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):
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 << 13;
sd ^= sd >> 7;
sd ^= sd << 11;
return sd;
}
inline double get_n()
{
double x = (double) (uint_rand() % 100000) / 100000;
return x + 4;
}
inline double get_k()
{
double x = (double) (uint_rand() % 100000) / 100000;
return (x + 1) * 5;
}
inline void read(double &n,double &a, double &b)
{
n = get_n(); a = get_k();
if (op) b = a;
else b = get_k();
}
}
After calling Mker::init(), when you call Mker::read(n,a,b) for the -th time, you will obtain the -th query’s , , and .
To reduce your output, let the answer to the -th query be . You only need to output . If the absolute error between your answer and the standard answer is within , your answer will be considered correct.
The testdata of this problem is generated using a high (da) precision (bao) algorithm with a time complexity much worse than normal algorithms, to ensure accuracy. The testdata guarantees that the error of each single query is less than , so the SPJ tolerance for this problem is completely sufficient for correct solutions.
To help you solve the problem, here is an explanation of :
- When , we have . Otherwise, there is no special constraint.
Input Format
The input contains one line with positive integers , , . Their meanings are described in the problem statement.
Output Format
Output one line, the answer required in the problem statement.
500 233 0
0.00503
10000 3141592653 0
0.10166
50000 1314159 0
0.50722
50000 1314159 1
1.51676
1000000 5201314 0
10.30487
Hint
Subtasks

Source
Lost House 2019 League (MtOI2019) T2
Problem setter: disangan233
Problem reviewer: suwakow
Translated by ChatGPT 5
京公网安备 11011102002149号