QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#622919#8795. Mysterious Sequencerns_ksr#WA 1ms5912kbC++14902b2024-10-09 08:30:572024-10-09 08:30:59

Judging History

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

  • [2024-10-09 08:30:59]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5912kb
  • [2024-10-09 08:30:57]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'