QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#500191 | #9136. Exponent Calculator | ucup-team3734 | WA | 11ms | 10544kb | Python3 | 1.1kb | 2024-08-01 01:15:51 | 2024-08-01 01:15:52 |
Judging History
answer
from math import factorial
ops = list()
ops.append('$1 = $1 * 0.03125')
cs = [
f'{1 / factorial(i):.20f}' for i in range(11)
# '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: 11ms
memory: 10544kb
input:
input
output:
27 $1 = $1 * 0.03125 $0 = 0.00000027557319223986 $0 = $0 * $1 $0 = $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 ...
result:
wrong answer Integer parameter [name=k] equals to 27, violates the range [0, 25]