QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#563566 | #8795. Mysterious Sequence | donghanwen1225 | Compile Error | / | / | C++20 | 372b | 2024-09-14 13:53:25 | 2024-09-14 13:53:25 |
Judging History
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;
}
Details
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++) | ^