QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#433206#8795. Mysterious Sequenceucup-team3282#WA 1ms4024kbC++20810b2024-06-08 08:21:272024-06-08 08:21:27

Judging History

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

  • [2024-06-08 08:21:27]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4024kb
  • [2024-06-08 08:21:27]
  • 提交

answer

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
double A,B,X1,X2,Xn;
int n;
struct fml{
    double a,b;
    fml operator +(const fml &x)const{
        fml ret;
        ret.a=a+x.a;
        ret.b=b+x.b;
        return ret;
    }
    fml operator *(const int &x)const{
        fml ret;
        ret.a=a*x;
        ret.b=b*x;
        return ret;
    }
    double cnt(double p,double q){
        return a*p+b*q;
    }
    void st(int q,int p){
        a=q,b=p;
    }
}x[10000];
int main(){
    cin>>A>>B>>n>>X1>>Xn;
    x[1].st(1,0);
    x[2].st(0,1);
    for(int i=3;i<=n;i++){
        x[i]=(x[i-1]*A)+(x[i-2]*B);
    }
    X2=(Xn-x[n].a*X1)/x[n].b;
    for(int i=1;i<=n;i++){
        printf("%.10lf\n",x[i].cnt(X1,X2));
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3760kb

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: 4016kb

input:

1 1 2 1 100

output:

1.0000000000
100.0000000000

result:

ok 2 numbers

Test #3:

score: 0
Accepted
time: 0ms
memory: 3800kb

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: 4024kb

input:

0.25 0.25 10 1 1

output:

-nan
inf
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan

result:

wrong output format Expected double, but "-nan" found