#P5515. [MtOI2019] 灵梦的计算器

    ID: 4370 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>数学2019洛谷原创Special JudgeO2优化微积分初步

[MtOI2019] 灵梦的计算器

Description

Reimu is given 3 real numbers nn, aa, bb (4n54 \le n \le 5, 5a,b105 \le a,b \le 10). She successfully computed na+nbn^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(n0)n'(n' \geq 0) such that the result of na+nb{n'}^a+{n'}^b shown on the calculator is exactly the same as the result shown for na+nbn^a+n^b, then what is the range of possible values of nn', i.e., the difference between the maximum and minimum possible nn'.

If you do not know how to compute nkn^k, please use the pow() function in the cmath library. The result of pow(n,k) is nkn^k.


To increase the difficulty of this problem, Reimu gives you TT 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 ii-th time, you will obtain the ii-th query’s nin_i, aia_i, and bib_i.

To reduce your output, let the answer to the ii-th query be sis_i. You only need to output i=1Tsi\sum^{T}_{i=1} s_i. If the absolute error between your answer and the standard answer is within 10210^{-2}, 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 101010^{-10}, so the SPJ tolerance for this problem is completely sufficient for correct solutions.


To help you solve the problem, here is an explanation of opop:

  • When op=1op=1, we have a=ba=b. Otherwise, there is no special constraint.

Input Format

The input contains one line with 33 positive integers TT, seedseed, opop. 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

QQ图片20190707214000.png

Source

Lost House 2019 League (MtOI2019) T2

Problem setter: disangan233

Problem reviewer: suwakow

Translated by ChatGPT 5