QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#500190#9136. Exponent Calculatorucup-team3734WA 14ms10580kbPython31.1kb2024-08-01 01:15:122024-08-01 01:15:12

Judging History

你现在查看的是最新测评结果

  • [2024-08-01 01:15:12]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:10580kb
  • [2024-08-01 01:15:12]
  • 提交

answer

from math import factorial
ops = list()
ops.append('$1 = $1 * 0.03125')
cs = [
    f'{1 / factorial(i):.20f}' for i in range(10)
    # '1.00000000000409250411',
    # '0.99999999996229649302',
    # '0.49999999943843465022',
    # '0.16666666793726392370',
    # '0.04166667869120328771',
    # '0.00833332210917809603',
    # '0.00138880002043589921',
    # '0.00019844700093970611',
    # '0.00002506724645050853',
    # '0.00000273136629213122',
]

ops.append(f'$0 = {cs[-1]}')
for x in cs[-2::-1]:
    ops.append('$0 = $0 * $1')
    if x == '-':
        ops.append('$0 = $0 - ' + x)
    else:
        ops.append('$0 = $0 + ' + x)

ops.append('$0 = $0 * $0')
ops.append('$0 = $0 * $0')
ops.append('$0 = $0 * $0')
ops.append('$0 = $0 * $0')
ops.append('$0 = $0 * $0')

print(len(ops))
for op in ops:
    print(op)

# import re
# def evl(ops, x):
#     regs = [0.0] * 10
#     regs[1] = x
#     for op in ops:
#         l = re.sub(r'\$(\d+)', r'regs[\1]', op)
#         exec(l)
#         print(op)
#         print(regs)
#     return regs[0]

# import math
# x = -10
# print(evl(ops, x) / math.exp(x))

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 14ms
memory: 10580kb

input:

input

output:

25
$1 = $1 * 0.03125
$0 = 0.00000275573192239859
$0 = $0 * $1
$0 = $0 + 0.00002480158730158730
$0 = $0 * $1
$0 = $0 + 0.00019841269841269841
$0 = $0 * $1
$0 = $0 + 0.00138888888888888894
$0 = $0 * $1
$0 = $0 + 0.00833333333333333322
$0 = $0 * $1
$0 = $0 + 0.04166666666666666435
$0 = $0 * $1
$0 = $0 ...

result:

wrong answer x=-20,jury=2.06115e-09,participant=2.06115e-09,error=1.41747e-07