QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#579012#5127. Crashing Competition Computerjoshua_125RE 12ms10632kbPython3741b2024-09-21 01:15:152024-09-21 01:15:17

Judging History

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

  • [2024-09-21 01:15:17]
  • 评测
  • 测评结果:RE
  • 用时:12ms
  • 内存:10632kb
  • [2024-09-21 01:15:15]
  • 提交

answer

import functools

c, s, r = [int(x) for x in input().split()]
p = float(input())

@functools.cache
def expected_time_no_saving(chars, r, p):
    if chars == 0:
        return 0

    return (expected_time_no_saving(chars - 1, r, p) + 1 + p * r) / (1 - p)

# ends on save
@functools.cache
def expected_total_time(chars, s, r, p):
    if chars == 0:
        return 0

    min_time = None

    for last_save_after in range(0, chars):
        this_time = (
            expected_total_time(last_save_after, s, r, p) +
            expected_time_no_saving(chars - last_save_after, r, p) + s
        )

        if min_time is None or this_time < min_time:
            min_time = this_time

    return min_time

print(expected_total_time(c, s, r, p))

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 10592kb

input:

2 1 5
0.25

output:

8.0

result:

ok found '8.0000000', expected '8.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 7ms
memory: 10632kb

input:

3 5 2
0.5

output:

26.0

result:

ok found '26.0000000', expected '26.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 12ms
memory: 10612kb

input:

10 4 5
0.327

output:

68.66496735691464

result:

ok found '68.6649674', expected '68.6649674', error '0.0000000'

Test #4:

score: 0
Accepted
time: 9ms
memory: 10584kb

input:

1 0 0
0.0010000000

output:

1.001001001001001

result:

ok found '1.0010010', expected '1.0010010', error '0.0000000'

Test #5:

score: -100
Dangerous Syscalls

input:

2000 1000000000 1000000000
0.9990000000

output:


result: