QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#435174#8795. Mysterious SequenceForever_Young#WA 0ms4016kbC++17724b2024-06-08 19:11:432024-06-08 19:11:43

Judging History

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

  • [2024-06-08 19:11:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4016kb
  • [2024-06-08 19:11:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main() {
    typedef long double D;
    D a, b;
    int n;
    D x1, xn;
    cin >> a >> b >> n >> x1 >> xn;
    D lambda[2] = {(a + sqrt(a + 4 * b)) / 2, (a - sqrt(a + 4 * b)) / 2};
    D ln[2] = {1, 1};
    for(int i = 0; i < n; i++) {
        for(int d = 0; d < 2; d++) {
            ln[d] *= lambda[d];
        }
    }
    D c = (x1 * ln[1] - xn * lambda[1]) / (lambda[0] * ln[1] - lambda[1] * ln[0]);
    D d = (x1 - c * lambda[0]) / lambda[1];
    ln[0] = lambda[0];
    ln[1] = lambda[1];
    for(int i = 1; i <= n; i++) {
        printf("%.12f\n", double(c * ln[0] + d * ln[1]));
        ln[0] *= lambda[0];
        ln[1] *= lambda[1];
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3964kb

input:

1.0 1.0 10 1 10

output:

1.000000000000
-0.323529411765
0.676470588235
0.352941176471
1.029411764706
1.382352941176
2.411764705882
3.794117647059
6.205882352941
10.000000000000

result:

ok 10 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

1 1 2 1 100

output:

1.000000000000
100.000000000000

result:

ok 2 numbers

Test #3:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

1 1 5 50 100

output:

50.000000000000
-0.000000000000
50.000000000000
50.000000000000
100.000000000000

result:

ok 5 numbers

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 4016kb

input:

0.25 0.25 10 1 1

output:

1.000000000000
33.132776365807
8.580069091452
11.981310256462
5.542535575640
4.942585376297
2.881086593092
2.187601681861
1.402223002790
1.000000000000

result:

wrong answer 2nd numbers differ - expected: '55.8755365', found: '33.1327764', error = '0.4070254'