QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#558038#8795. Mysterious Sequencechenyueshan#WA 0ms3916kbC++14895b2024-09-11 13:43:572024-09-11 13:43:57

Judging History

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

  • [2024-09-11 13:43:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3916kb
  • [2024-09-11 13:43:57]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define int long long
const int mod = 1e9 + 7;
const int N = 1e6 + 50;
double x[N][2];
void solve()
{
    int n;
    double a, b, x1, xn;
    cin >> a >> b >> n >> x1 >> xn;
    x[2][1] = 1;
    x[1][0] = x1;
    for (int i = 3; i <= n; i++)
    {
        x[i][1] = x[i - 1][1] * a + x[i - 2][1] * b;
        x[i][0] = x[i - 1][0] * a + x[i - 2][0] * b;
    }
    double x2 = (xn - x[n][0]) / x[n][1];
    cout << x1 << '\n';
    cout << fixed << setprecision(10) << x2 << '\n';
    for (int i = 3; i <= n; i++)
    {
        cout << fixed << setprecision(10) << x1 * x[i][0] + x2 * x[i][1] << '\n';
    }
}
signed main()
{
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int T = 1;
    // cin >> T;
    while (T--)
    {
        solve();
    }
}

详细

Test #1:

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

input:

1.0 1.0 10 1 10

output:

1
-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: 0ms
memory: 3716kb

input:

1 1 2 1 100

output:

1
100.0000000000

result:

ok 2 numbers

Test #3:

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

input:

1 1 5 50 100

output:

50
0.0000000000
2500.0000000000
2500.0000000000
5000.0000000000

result:

wrong answer 3rd numbers differ - expected: '50.0000000', found: '2500.0000000', error = '49.0000000'