QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#622919 | #8795. Mysterious Sequence | rns_ksr# | WA | 1ms | 5912kb | C++14 | 902b | 2024-10-09 08:30:57 | 2024-10-09 08:30:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef __float128 ld;
#define pii pair<double, double>
#define fi first
#define se second
#define VI vector<int>
#define VII vector<vector<int> >
const int N = 500500;
const int inf = 1e9 + 100;
const ll infll = 2e18 + 500;
pii val[N];
double ans[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
double a, b;
int n, x, y;
cin >> a >> b >> n >> x >> y;
val[1] = pii(1, 0);
val[2] = pii(0, 1);
for (int i = 3; i <= n; i++) {
val[i].fi = b * val[i - 2].fi + a * val[i - 1].fi;
val[i].se = b * val[i - 2].se + a * val[i - 1].se;
}
ans[1] = x, ans[n] = y;
ans[2] = (1.0 * y - val[n].fi * x) / val[n].se;
for (int i = 3; i <= n - 1; i++) ans[i] = ans[i - 2] * b + ans[i - 1] * a;
for (int i = 1; i <= n; i++) cout << ans[i] << endl;
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5912kb
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'