QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#563570#8795. Mysterious Sequencedonghanwen1225WA 0ms3992kbC++20530b2024-09-14 13:55:042024-09-14 13:55:04

Judging History

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

  • [2024-09-14 13:55:04]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3992kb
  • [2024-09-14 13:55:04]
  • 提交

answer

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	double a,b;int n,x1,xn;
	cin>>a>>b;cin>>n>>x1>>xn;
	double l=-10000,r=10000;
	while(r-l>1e-12)
	{
		double mid=(l+r)/2;
		double c1=x1,c2=mid;
		for(int i=3;i<=n;i++)
		{
			double nc=c1*a+c2*b;
			c1=c2;c2=nc;
		}
		if(c2<xn) l=mid;
		else r=mid;
	}
	printf("%d\n%.12lf\n",x1,r);
	double c1=x1,c2=r;
	for(int i=3;i<n;i++)
	{
		double nc=c1*a+c2*b;
		c1=c2;c2=nc;printf("%.12lf\n",nc);
	}
	if(n>=3) printf("%d\n",xn);
	return 0;
}

详细

Test #1:

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

input:

1.0 1.0 10 1 10

output:

1
-0.323529411764
0.676470588236
0.352941176471
1.029411764707
1.382352941179
2.411764705886
3.794117647064
6.205882352950
10

result:

ok 10 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 3992kb

input:

1 1 2 1 100

output:

1
100.000000000000

result:

ok 2 numbers

Test #3:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

1 1 5 50 100

output:

50
0.000000000000
50.000000000000
50.000000000000
100

result:

ok 5 numbers

Test #4:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

0.25 0.25 10 1 1

output:

1
55.875536480687
14.218884120172
17.523605150215
7.935622317597
6.364806866953
3.575107296137
2.484978540773
1.515021459227
1

result:

ok 10 numbers

Test #5:

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

input:

0.25 0.63 6 93 12

output:

93
-2.196895156100
21.865956051657
13.226328523519
13.799075982731
12

result:

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