QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#438139#8795. Mysterious SequenceDjangle162857#WA 0ms3924kbC++11452b2024-06-10 10:31:592024-06-10 10:32:00

Judging History

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

  • [2024-06-10 10:32:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3924kb
  • [2024-06-10 10:31:59]
  • 提交

answer

#include <bits/stdc++.h>
const int N=15;
using namespace std;
double x[N],y[N],z,A,B,ans[N];
int n;
signed main() {
	//cout<<x[2]<<endl;
	cin>>A>>B>>n>>x[1]>>z;
	y[2]=1;
	for(int i=3;i<=n;i++) {
		x[i]=A*x[i-1]+B*x[i-2];
		y[i]=A*y[i-1]+B*y[i-2];
	}
	//ans[2]*y[10]+x[10]=z
	ans[1]=x[1];ans[2]=(z-x[10])/y[10];
	for(int i=3;i<=n;i++) {
		ans[i]=A*ans[i-1]+B*ans[i-2];
	}
	for(int i=1;i<=n;i++) printf("%.10f\n",ans[i]);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3920kb

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: -100
Wrong Answer
time: 0ms
memory: 3924kb

input:

1 1 2 1 100

output:

1.0000000000
inf

result:

wrong output format Expected double, but "inf" found