QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#558038 | #8795. Mysterious Sequence | chenyueshan# | WA | 0ms | 3916kb | C++14 | 895b | 2024-09-11 13:43:57 | 2024-09-11 13:43:57 |
Judging History
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();
}
}
Details
Tip: Click on the bar to expand more detailed information
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'