QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#558032#8795. Mysterious Sequencechenyueshan#WA 0ms3872kbC++14868b2024-09-11 13:37:292024-09-11 13:37:30

Judging History

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

  • [2024-09-11 13:37:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3872kb
  • [2024-09-11 13:37:29]
  • 提交

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;
//<< fixed << setprecision(1)
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 << x2 << '\n';
    for (int i = 3; i <= n; i++)
    {
        cout << 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();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3872kb

input:

1.0 1.0 10 1 10

output:

1
-0.323529
0.676471
0.352941
1.02941
1.38235
2.41176
3.79412
6.20588
10

result:

wrong answer 5th numbers differ - expected: '1.0294118', found: '1.0294100', error = '0.0000017'