QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#622900#8795. Mysterious Sequencerns_ksr#WA 1ms5900kbC++14931b2024-10-09 08:23:162024-10-09 08:23:17

Judging History

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

  • [2024-10-09 08:23:17]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5900kb
  • [2024-10-09 08:23:16]
  • 提交

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 = a * val[i - 2].fi + b * val[i - 1].fi;
		val[i].se = a * val[i - 2].se + b * 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] * a + ans[i - 1] * b;
	for (int i = 1; i <= n; i++) cout << setprecision(10) << fixed << ans[i] << endl;

    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5880kb

input:

1.0 1.0 10 1 10

output:

1.0000000000
-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: 1ms
memory: 5900kb

input:

1 1 2 1 100

output:

1.0000000000
100.0000000000

result:

ok 2 numbers

Test #3:

score: 0
Accepted
time: 1ms
memory: 5892kb

input:

1 1 5 50 100

output:

50.0000000000
0.0000000000
50.0000000000
50.0000000000
100.0000000000

result:

ok 5 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 5844kb

input:

0.25 0.25 10 1 1

output:

1.0000000000
55.8755364807
14.2188841202
17.5236051502
7.9356223176
6.3648068670
3.5751072961
2.4849785408
1.5150214592
1.0000000000

result:

ok 10 numbers

Test #5:

score: -100
Wrong Answer
time: 1ms
memory: 5884kb

input:

0.25 0.63 6 93 12

output:

93.0000000000
-2.1968951561
21.8659560517
13.2263285235
13.7990759827
12.0000000000

result:

wrong answer 2nd numbers differ - expected: '-14.2048080', found: '-2.1968952', error = '0.8453414'