QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#438139 | #8795. Mysterious Sequence | Djangle162857# | WA | 0ms | 3924kb | C++11 | 452b | 2024-06-10 10:31:59 | 2024-06-10 10:32:00 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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