QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#433319#8795. Mysterious Sequenceucup-team3646#AC ✓0ms4056kbC++171.9kb2024-06-08 10:19:442024-06-08 10:19:44

Judging History

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

  • [2024-06-08 10:19:44]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:4056kb
  • [2024-06-08 10:19:44]
  • 提交

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=10001.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;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

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

input:

1 1 2 1 100

output:

1.00000000000000
99.99999999999999

result:

ok 2 numbers

Test #3:

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

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

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

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

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

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

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: 0
Accepted
time: 0ms
memory: 3768kb

input:

0.31 0.40 7 10 49

output:

10.00000000000000
240.11506399868821
78.43566983959334
120.36108324974921
68.68620374325960
69.43715646031016
48.99999999999999

result:

ok 7 numbers

Test #10:

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

input:

0.32 0.28 5 36 6

output:

36.00000000000000
10.12137681159419
13.31884057971014
7.09601449275362
6.00000000000000

result:

ok 5 numbers

Test #11:

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

input:

0.35 0.65 10 86 82

output:

86.00000000000000
79.53392478623083
83.73687367518079
81.00495689736331
82.78070280294467
81.62646796431679
82.37672060942491
81.88905639010463
82.20603813266281
81.99999999999999

result:

ok 10 numbers

Test #12:

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

input:

0.36 0.68 8 72 59

output:

72.00000000000000
38.23991864260569
62.72637071133805
48.58463813305356
60.14440181160916
54.68953858265571
60.58642712165029
58.99999999999999

result:

ok 8 numbers

Test #13:

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

input:

0.43 0.61 2 93 84

output:

93.00000000000000
83.99999999999999

result:

ok 2 numbers

Test #14:

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

input:

0.46 0.96 6 65 35

output:

65.00000000000000
-16.61742366281806
54.75598511510369
9.23502643664237
56.81385787135503
34.99999999999999

result:

ok 6 numbers

Test #15:

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

input:

0.50 0.90 4 19 1

output:

19.00000000000000
-6.56521739130435
13.81739130434783
1.00000000000000

result:

ok 4 numbers

Test #16:

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

input:

0.54 0.35 3 16 22

output:

16.00000000000000
30.37037037037036
21.99999999999999

result:

ok 3 numbers

Test #17:

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

input:

0.55 0.89 10 74 13

output:

74.00000000000000
-48.32193707657652
39.28293460788291
-21.40090996381750
23.19131132091617
-6.29158864129368
17.17989332290386
3.84942743684575
17.40729014764960
13.00000000000000

result:

ok 10 numbers

Test #18:

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

input:

0.56 0.36 3 31 88

output:

31.00000000000000
137.21428571428569
87.99999999999999

result:

ok 3 numbers

Test #19:

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

input:

0.57 0.93 7 71 48

output:

71.00000000000000
-34.08056536168603
46.60407774383897
-5.13060147237979
40.41734946251376
18.26642982431963
47.99999999999999

result:

ok 7 numbers

Test #20:

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

input:

0.58 0.41 8 30 69

output:

30.00000000000000
89.43212168280982
64.17063057602969
73.88613562404925
69.16391719812073
70.40838758077021
69.19407084807622
68.99999999999999

result:

ok 8 numbers

Test #21:

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

input:

0.58 0.49 6 31 96

output:

31.00000000000000
99.55761353841716
72.93341585228195
91.08461182814794
88.56644862794397
95.99999999999999

result:

ok 6 numbers

Test #22:

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

input:

0.61 0.29 8 62 25

output:

62.00000000000000
34.40765125713371
38.96866726685156
33.74910589734823
31.88786810476937
29.23884025414030
27.08317430540870
24.99999999999999

result:

ok 8 numbers

Test #23:

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

input:

0.63 0.89 9 37 85

output:

37.00000000000000
-5.88785330217689
29.22065241962856
13.16882158542856
34.30273825228941
33.33097630997375
51.52795211982104
62.12717875136389
84.99999999999997

result:

ok 9 numbers

Test #24:

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

input:

0.64 0.67 2 74 42

output:

74.00000000000000
41.99999999999999

result:

ok 2 numbers

Test #25:

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

input:

0.65 0.56 2 94 96

output:

94.00000000000000
95.99999999999999

result:

ok 2 numbers

Test #26:

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

input:

0.65 0.90 10 97 23

output:

97.00000000000000
-61.70357627911756
47.19267541857359
-24.85797962913297
26.31572111777980
-5.26696293966280
20.26062309522100
8.42913836619712
23.71350072372703
22.99999999999998

result:

ok 10 numbers

Test #27:

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

input:

0.67 0.88 4 70 42

output:

70.00000000000000
0.54782150650914
61.96704040936113
41.99999999999999

result:

ok 4 numbers

Test #28:

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

input:

0.69 0.39 10 2 27

output:

2.00000000000000
22.36590768701613
16.21247630404113
19.90931264772467
20.06029148550606
21.60623305761180
22.73181448909950
24.11138288994726
25.50226184481241
26.99999999999999

result:

ok 10 numbers

Test #29:

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

input:

0.69 0.57 4 88 47

output:

88.00000000000000
11.84360959755282
58.33209062231144
46.99999999999999

result:

ok 4 numbers

Test #30:

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

input:

0.71 0.89 8 4 41

output:

4.00000000000000
6.83889036269107
8.41561215751066
12.06169705462762
16.05369972897010
22.13303718618735
30.00224916097640
40.99999999999999

result:

ok 8 numbers

Test #31:

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

input:

0.72 0.49 8 21 48

output:

21.00000000000000
19.94044236994031
24.64711850635702
27.51674208584780
31.88914236992535
36.44338612841167
41.86491777371982
47.99999999999999

result:

ok 8 numbers

Test #32:

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

input:

0.74 0.58 3 57 29

output:

57.00000000000000
-5.48648648648648
29.00000000000000

result:

ok 3 numbers

Test #33:

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

input:

0.76 0.70 2 91 18

output:

91.00000000000000
18.00000000000000

result:

ok 2 numbers

Test #34:

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

input:

0.77 0.36 10 31 25

output:

31.00000000000000
5.21497208502642
15.17552850547034
13.56254689982168
15.90635137483202
17.13040744255645
18.91670022570800
20.73280585311548
22.77427258815380
24.99999999999999

result:

ok 10 numbers

Test #35:

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

input:

0.77 0.96 8 78 68

output:

78.00000000000000
-40.09755700760498
44.00488110414416
-4.60989627710978
38.69506572660386
25.36970018345959
56.68193223880360
67.99999999999997

result:

ok 8 numbers

Test #36:

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

input:

0.78 0.52 7 73 77

output:

73.00000000000000
8.72754750605292
44.76748705472128
39.45696460583012
54.05552566100256
62.68093161061365
76.99999999999999

result:

ok 7 numbers

Test #37:

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

input:

0.78 0.69 4 42 97

output:

42.00000000000000
57.29790511398643
73.67236598890941
96.99999999999997

result:

ok 4 numbers

Test #38:

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

input:

0.78 0.70 10 54 99

output:

54.00000000000000
-13.01288635089970
27.64994864629823
12.45793949848283
29.07215686122537
31.39684000069377
44.84004500339890
56.95302310313678
75.81138952282592
98.99999999999997

result:

ok 10 numbers

Test #39:

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

input:

0.78 0.76 10 97 83

output:

97.00000000000000
-43.73473695904050
39.60690517194841
-2.34501405475102
28.27213696797500
20.27005615340973
37.29746789532059
44.49726763494145
63.05394435569798
82.99999999999993

result:

ok 10 numbers

Test #40:

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

input:

0.78 0.95 10 100 32

output:

100.00000000000000
-63.26957881736413
45.64972852245597
-24.49931162898027
24.25777902572856
-4.35327840746297
19.64933291662102
11.19086518787457
27.39574111733213
31.99999999999990

result:

ok 10 numbers

Test #41:

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

input:

0.79 0.90 10 98 42

output:

98.00000000000000
-58.24691462804137
42.18493744384732
-19.09612258459785
22.88050685763029
0.88909009138986
21.29483734406525
17.62310258406242
33.08760465106803
41.99999999999993

result:

ok 10 numbers

Test #42:

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

input:

0.81 0.48 10 97 1

output:

97.00000000000000
-38.25750168159922
15.57142363790463
-5.75074766046487
2.81617774121768
-0.47925490663682
0.96356884140866
0.55044840635534
0.90837625302398
0.99999999999999

result:

ok 10 numbers

Test #43:

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

input:

0.81 0.86 10 20 100

output:

20.00000000000000
-3.33284286965140
14.50039727558236
8.87907692532151
19.66239396651125
23.56254526865061
35.99532047880667
49.41999851887293
70.98617441206081
99.99999999999997

result:

ok 10 numbers

Test #44:

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

input:

0.84 0.85 10 74 95

output:

74.00000000000000
-36.29080487709830
32.41572390323743
-3.61797606681410
24.51426542162797
17.51670329737551
35.55115637817920
44.75216916043971
67.81030501622166
94.99999999999994

result:

ok 10 numbers

Test #45:

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

input:

0.88 0.37 10 3 96

output:

3.00000000000000
29.02182849037642
26.64920907153125
34.18938052438677
39.94686221792692
47.80330954579880
56.84725142093590
67.71280578236914
80.62075211423112
95.99999999999997

result:

ok 10 numbers

Test #46:

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

input:

0.91 0.50 10 100 98

output:

100.00000000000000
-22.58685785448443
29.44595935241917
15.50239408345923
28.83015829215748
33.98664108759293
45.34292253578830
58.25538005136382
75.68385711463523
97.99999999999997

result:

ok 10 numbers

Test #47:

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

input:

0.94 0.48 10 44 97

output:

44.00000000000000
-1.58274343871780
19.63222116760527
17.69457104696441
26.05636294459707
32.98637527046415
43.51424696764289
56.73685227940710
74.21947968711126
96.99999999999999

result:

ok 10 numbers

Test #48:

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

input:

0.94 0.54 10 28 95

output:

28.00000000000000
0.45254630714584
15.54539352871709
14.85704492285282
22.36013473298888
29.04133090735007
39.37332380872306
52.69324307016871
70.79324334266903
94.99999999999999

result:

ok 10 numbers

Test #49:

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

input:

0.95 0.57 10 2 94

output:

2.00000000000000
9.22728417416106
9.90591996545301
14.67017594645216
19.58304152943776
26.96588974244360
36.77992892710094
50.31148963393874
68.76047464068934
93.99999999999996

result:

ok 10 numbers

Test #50:

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

input:

0.98 0.90 10 21 99

output:

21.00000000000000
-8.21319348497018
10.85107038472923
3.24217484056148
12.94329469000656
15.60238615271176
26.93930365066343
40.44266511509075
63.87918509838602
98.99999999999997

result:

ok 10 numbers

Extra Test:

score: 0
Extra Test Passed