QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#622993#8795. Mysterious Sequencerns_rds#WA 1ms3832kbC++23836b2024-10-09 09:26:252024-10-09 09:26:26

Judging History

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

  • [2024-10-09 09:26:26]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3832kb
  • [2024-10-09 09:26:25]
  • 提交

answer

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

#define double long double

void solve() {
	const double inf = 1e6;
	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: 3832kb

input:

1.0 1.0 10 1 10

output:

1.000000000000
-0.323529412150
0.676470587850
0.352941175701
1.029411763551
1.382352939252
2.411764702804
3.794117642056
6.205882344860
10.000000000000

result:

ok 10 numbers

Test #2:

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

input:

1 1 2 1 100

output:

1.000000000000
99.999999998879
100.000000000000

result:

wrong output format Extra information in the output file