QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#433747#8795. Mysterious Sequenceucup-team3702#WA 14ms10664kbPython3345b2024-06-08 13:24:242024-06-08 13:24:24

Judging History

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

  • [2024-06-08 13:24:24]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:10664kb
  • [2024-06-08 13:24:24]
  • 提交

answer

a, b, n, x, y = map(eval, input().split())
l, r, eps = -100, 100, 1e-8

while r - l > eps:
    mid = (l + r) / 2
    f = [x, mid]
    for i in range(2, n):
        f.append(a * f[i - 1] + b * f[i - 2])
    if f[n - 1] >= y: r = mid
    else: l = mid

print(x, l, sep='\n')
for i in range(2, n):
    print(x + l)
    x, l = l, x + l

详细

Test #1:

score: 100
Accepted
time: 6ms
memory: 10628kb

input:

1.0 1.0 10 1 10

output:

1
-0.32352941343560815
0.6764705865643919
0.3529411731287837
1.0294117596931756
1.3823529328219593
2.411764692515135
3.794117625337094
6.205882317852229
9.999999943189323

result:

ok 10 numbers

Test #2:

score: 0
Accepted
time: 14ms
memory: 10600kb

input:

1 1 2 1 100

output:

1
99.99999999417923

result:

ok 2 numbers

Test #3:

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

input:

1 1 5 50 100

output:

50
-5.820766091346741e-09
49.999999994179234
49.99999998835847
99.9999999825377

result:

ok 5 numbers

Test #4:

score: -100
Wrong Answer
time: 9ms
memory: 10520kb

input:

0.25 0.25 10 1 1

output:

1
55.87553647928871
56.87553647928871
112.75107295857742
169.62660943786614
282.37768239644356
452.0042918343097
734.3819742307533
1186.386266065063
1920.7682402958162

result:

wrong answer 3rd numbers differ - expected: '14.2188841', found: '56.8755365', error = '3.0000000'