QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#563568#8795. Mysterious Sequencedonghanwen1225WA 0ms3728kbC++20377b2024-09-14 13:53:552024-09-14 13:53:56

Judging History

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

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

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("%.12lf",r);
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3728kb

input:

1.0 1.0 10 1 10

output:

-0.323529411764

result:

wrong answer 1st numbers differ - expected: '1.0000000', found: '-0.3235294', error = '1.3235294'