QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#563566#8795. Mysterious Sequencedonghanwen1225Compile Error//C++20372b2024-09-14 13:53:252024-09-14 13:53:25

Judging History

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

  • [2024-09-14 13:53:25]
  • 评测
  • [2024-09-14 13:53:25]
  • 提交

answer

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	double a,b;int x1,xn;
	cin>>a>>b;cin>>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;
}

详细

answer.code: In function ‘int main()’:
answer.code:13:32: error: ‘n’ was not declared in this scope
   13 |                 for(int i=3;i<=n;i++)
      |                                ^