QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#433313#8795. Mysterious Sequenceucup-team3646#WA 0ms4052kbC++171.9kb2024-06-08 10:18:012024-06-08 10:18:01

Judging History

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

  • [2024-06-08 10:18:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4052kb
  • [2024-06-08 10:18:01]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define elif else if
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int,int>


#define repname(a, b, c, d, e, ...) e
#define rep(...)                    repname(__VA_ARGS__, rep3, rep2, rep1, rep0)(__VA_ARGS__)
#define rep0(x)                     for (int rep_counter = 0; rep_counter < (x); ++rep_counter)
#define rep1(i, x)                  for (int i = 0; i < (x); ++i)
#define rep2(i, l, r)               for (int i = (l); i < (r); ++i)
#define rep3(i, l, r, c)            for (int i = (l); i < (r); i += (c))





struct ScalarInput {
    template<class T>
    operator T(){
        T ret;
        cin >> ret;
        return ret;
    }
};
struct VectorInput {
    size_t n;
    VectorInput(size_t n): n(n) {}
    template<class T>
    operator vector<T>(){
        vector<T> ret(n);
        for(T &x : ret) cin >> x;
        return ret;
    }
};
ScalarInput input(){ return ScalarInput(); }
VectorInput input(size_t n){ return VectorInput(n); }

template<typename T>
void print(vector<T> a){
  for(int i=0;i<a.size();i++){
    cout<<a[i]<<" \n"[i+1==a.size()];
  }
}

template<class T>
void print(T x){
    cout << x << '\n';
}
 
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail){
  cout << head << ' ';
  print(forward<Tail>(tail)...);
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  double A,B;
  ll N;
  double P,Q;
  cin>>A>>B>>N>>P>>Q;
  double D=-P,U=101.0;

  
  vector<double> X(N);
  rep(i,100){
    double M=(D+U)/2.0;
    X[0]=P;
    X[1]=M;
    rep(i,N-2)X[i+2]=A*X[i+1]+B*X[i];
    if(X[N-1]<Q)D=M;
    else U=M;
  }
  X[0]=P;
    X[1]=D;
    rep(i,N-2)X[i+2]=A*X[i+1]+B*X[i];
    cout<<fixed<<setprecision(14);
  rep(i,N)cout<<X[i]<<endl;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3916kb

input:

1.0 1.0 10 1 10

output:

1.00000000000000
-0.32352941176471
0.67647058823529
0.35294117647059
1.02941176470588
1.38235294117647
2.41176470588235
3.79411764705882
6.20588235294117
10.00000000000000

result:

ok 10 numbers

Test #2:

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

input:

1 1 2 1 100

output:

1.00000000000000
99.99999999999999

result:

ok 2 numbers

Test #3:

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

input:

1 1 5 50 100

output:

50.00000000000000
-0.00000000000000
49.99999999999999
49.99999999999999
99.99999999999997

result:

ok 5 numbers

Test #4:

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

input:

0.25 0.25 10 1 1

output:

1.00000000000000
55.87553648068668
14.21888412017167
17.52360515021459
7.93562231759656
6.36480686695279
3.57510729613734
2.48497854077253
1.51502145922747
1.00000000000000

result:

ok 10 numbers

Test #5:

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

input:

0.25 0.63 6 93 12

output:

93.00000000000000
-14.20480795866505
55.03879801033374
4.81067048862445
35.87711036866637
12.00000000000000

result:

ok 6 numbers

Test #6:

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

input:

0.25 0.80 10 5 63

output:

5.00000000000000
78.76953618353132
23.69238404588283
68.93872495829577
36.18858847628020
64.19812708570666
45.00040255245083
62.60860230667804
51.65247261863017
62.99999999999997

result:

ok 10 numbers

Test #7:

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

input:

0.25 0.99 3 18 30

output:

18.00000000000000
48.71999999999998
30.00000000000000

result:

ok 3 numbers

Test #8:

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

input:

0.28 0.64 9 6 10

output:

6.00000000000000
20.95040334850780
9.70611293758218
16.12596976556800
10.72718381441164
13.32423211799878
10.59618263426311
11.49443969311289
10.00000000000000

result:

ok 9 numbers

Test #9:

score: -100
Wrong Answer
time: 0ms
memory: 3880kb

input:

0.31 0.40 7 10 49

output:

10.00000000000000
101.00000000000000
35.31000000000000
51.34610000000001
30.04129100000000
29.85124021000001
21.27040086510000

result:

wrong answer 2nd numbers differ - expected: '240.1150640', found: '101.0000000', error = '0.5793683'