QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#440447 | #8795. Mysterious Sequence | _CLY_ | WA | 1ms | 3956kb | C++14 | 724b | 2024-06-13 18:51:59 | 2024-06-13 18:52:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
inline long long read(){
long long x=0; char ch; bool f=0;
while(((ch=getchar())<'0'||ch>'9')&&ch!='-') ;
if(ch=='-') f=1;
else x=ch^48;
while((ch=getchar())>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48);
return f?-x:x;
}
const int N=15;
int n;
double A,B,X1,Xn,f1[N],f2[N],x[N];
int main(){
scanf("%lf%lf%d%lf%lf",&A,&B,&n,&X1,&Xn);
f1[1]=1.0/A,f2[1]=0;
f1[2]=0,f2[2]=1.0/B;
f1[3]=B,f2[3]=A;
for(int i=4;i<=n;i++){
f1[i]=f1[i-1]+f1[i-2];
f2[i]=f2[i-1]+f2[i-2];
}
double X2=Xn-X1*f1[n]*A;
X2=X2/f2[n]/B;
x[1]=X1,x[2]=X2;
for(int i=3;i<n;i++) x[i]=x[i-1]*A+x[i-2]*B;
x[n]=Xn;
for(int i=1;i<=n;i++) printf("%.10lf\n",x[i]);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3952kb
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: 0
Accepted
time: 0ms
memory: 3956kb
input:
1 1 2 1 100
output:
1.0000000000 100.0000000000
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
1 1 5 50 100
output:
50.0000000000 0.0000000000 50.0000000000 50.0000000000 100.0000000000
result:
ok 5 numbers
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3868kb
input:
0.25 0.25 10 1 1
output:
1.0000000000 -0.0218340611 0.2445414847 0.0556768559 0.0750545852 0.0326828603 0.0269343614 0.0149043054 0.0104596667 1.0000000000
result:
wrong answer 2nd numbers differ - expected: '55.8755365', found: '-0.0218341', error = '1.0003908'