QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#622987#8795. Mysterious Sequencerns_rds#WA 1ms3928kbC++23836b2024-10-09 09:24:002024-10-09 09:24:02

Judging History

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

  • [2024-10-09 09:24:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3928kb
  • [2024-10-09 09:24:00]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define double long double

void solve() {
	const double inf = 1e3;
	const double ep = 1e-9;
	double a, b;
	cin >> a >> b;
	int n;
	cin >> n;
	double x, y;
	cin >> x >> y;
	double lo = -inf, hi = inf;
	auto calc = [&](double val) {
		double fi = x, se = val;
		for (int i = 3; i <= n; i++) {
			double tmp = fi + se;
			fi = se, se = tmp;
		}
		return se;
	};
	while (hi > lo + ep) {
		double mid = (hi + lo) / 2;
		if (calc(mid) + ep < y) lo = mid;
		else hi = mid;
	}
	cout << setprecision(12) << fixed;
	cout << x << "\n" << lo << "\n";
	for (int i = 3; i < n; i++) {
		double tmp = x + lo;
		x = lo, lo = tmp;
		cout << lo << "\n";
	}
	cout << y << "\n";
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}

详细

Test #1:

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

input:

1.0 1.0 10 1 10

output:

1.000000000000
-0.323529412526
0.676470587474
0.352941174948
1.029411762422
1.382352937369
2.411764699791
3.794117637161
6.205882336952
10.000000000000

result:

ok 10 numbers

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3928kb

input:

1 1 2 1 100

output:

1.000000000000
99.999999998545
100.000000000000

result:

wrong output format Extra information in the output file