改编的数学题
  • 板块学术版
  • 楼主WhtshpBlkhse
  • 当前回复16
  • 已保存回复16
  • 发布时间2023/6/26 10:24
  • 上次更新2023/11/3 12:24:26
查看原帖
改编的数学题
472885
WhtshpBlkhse楼主2023/6/26 10:24

problem:

when x^(x^5) = n, 1 <= n <= 10^8, and n∈Z ask x.(sepcial judge)

example:

input: 1000000; output: 1.86000448 ————————————————————— solution:



目标值 = int(input())

def f(h):
    return h ** (h ** 5)
    
左, 右, 误差 =  1.0, 2.0, 10 ** (-8)
while 右 - 左 > 误差:
    中 = (左 + 右) / 2.0
    y = f(中)
    if y < 目标值: 左 = 中
    else: 右 = 中
    
print(中) 

————————————————————— Thinking:

Is this solution right? Can you write another solution? —————————————————————

2023/6/26 10:24
加载中...