QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#459897#8795. Mysterious Sequenceucup-team2307#WA 1ms3892kbC++20899b2024-06-30 16:29:392024-06-30 16:29:39

Judging History

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

  • [2024-06-30 16:29:39]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3892kb
  • [2024-06-30 16:29:39]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back

typedef long long ll;
#define int ll

main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(10);

    double A, B, X, Y;
    int n;
    cin>>A>>B>>n>>X>>Y;
    if (n == 2)
        cout<<X<<" "<<Y<<"\n";
    else
    {
        double l = -1e3;
        double r = 1e3;
        vector<double> last;
        for (int _=0; _<200; _++)
        {
            double m = (l+r)/2;
            vector<double> v = {X, m};
            while (v.size() < n)
                v.pb({v[v.size()-2] * A + v.back() * B});
            last = v;
            if (v.back() < Y)
                l = m;
            else
                r = m;
        }
        for (double d : last)
            cout<<d<<"\n";
    }

}



详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3776kb

input:

1.0 1.0 10 1 10

output:

1.0000000000
-0.3235294118
0.6764705882
0.3529411765
1.0294117647
1.3823529412
2.4117647059
3.7941176471
6.2058823529
10.0000000000

result:

ok 10 numbers

Test #2:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

1 1 2 1 100

output:

1.0000000000 100.0000000000

result:

ok 2 numbers

Test #3:

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

input:

1 1 5 50 100

output:

50.0000000000
-0.0000000000
50.0000000000
50.0000000000
100.0000000000

result:

ok 5 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

0.25 0.25 10 1 1

output:

1.0000000000
55.8755364807
14.2188841202
17.5236051502
7.9356223176
6.3648068670
3.5751072961
2.4849785408
1.5150214592
1.0000000000

result:

ok 10 numbers

Test #5:

score: -100
Wrong Answer
time: 1ms
memory: 3720kb

input:

0.25 0.63 6 93 12

output:

93.0000000000
-2.1968951561
21.8659560517
13.2263285235
13.7990759827
12.0000000000

result:

wrong answer 2nd numbers differ - expected: '-14.2048080', found: '-2.1968952', error = '0.8453414'