QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#540926#8795. Mysterious SequenceNanani#AC ✓0ms3936kbC++201.2kb2024-08-31 18:09:142024-08-31 18:09:15

Judging History

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

  • [2024-08-31 18:09:15]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3936kb
  • [2024-08-31 18:09:14]
  • 提交

answer

//by 72
#include<bits/stdc++.h>
#define F(i, a, b) for(int i = a; i <= b; i ++)
#define Fd(i, a, b) for(int i = a; i >= b; i --)
#define pb push_back
#define pii pair<int, int>
#define fi first
#define se second
#define int long long
using namespace std;

const int mod = 998244353;
const int N = 2e5 + 10;
const int inf = 1e18;
typedef array<int, 3> a3; 
typedef long long ll;

int n;
double A, B, x1, xn;
const double eps = 1e-8;
double f[20];

double cal(double x) {
    f[1] = x1, f[2] = x;
    F(i, 3, n) f[i] = A * f[i - 1] + B * f[i - 2];
    return f[n];
}

void sol() {
    cout << fixed << setprecision(20);
    cin >> A >> B;
    cin >> n >> x1 >> xn;
    if(n == 2) {
        cout << x1 << "\n" << xn << "\n";
        return;
    }
    double l = -10000, r = 10000;
    while(r - l > eps) {
        double mid = (r + l) / 2;
        if(cal(mid) < xn) l = mid;
        else r = mid;
    }
    f[1] = x1, f[2] = l;
    F(i, 3, n) f[i] = A * f[i - 1] + B * f[i - 2];
    F(i, 1, n) cout << f[i] << "\n";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
    F(i, 1, t) sol();
    return 0;
}
//sldl

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

详细

Test #1:

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

input:

1.0 1.0 10 1 10

output:

1.00000000000000000000
-0.32352942071156576276
0.67647057928843423724
0.35294115857686847448
1.02941173786530271173
1.38235289644217118621
2.41176463430747389793
3.79411753074964508414
6.20588216505711898208
9.99999969580676406622

result:

ok 10 numbers

Test #2:

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

input:

1 1 2 1 100

output:

1.00000000000000000000
100.00000000000000000000

result:

ok 2 numbers

Test #3:

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

input:

1 1 5 50 100

output:

50.00000000000000000000
-0.00000000909494701773
49.99999999090505298227
49.99999998181010596454
99.99999997271515894681

result:

ok 5 numbers

Test #4:

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

input:

0.25 0.25 10 1 1

output:

1.00000000000000000000
55.87553647274035029113
14.21888411818508757278
17.52360514773135946598
7.93562231647911175969
6.36480686605261780642
3.57510729563293239153
2.48497854042138754949
1.51502145901357998525
0.99999999985874188368

result:

ok 10 numbers

Test #5:

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

input:

0.25 0.63 6 93 12

output:

93.00000000000000000000
-14.20480796696210745722
55.03879800825947654630
4.81067048287874143853
35.87711036592315849703
11.99999999569439701474

result:

ok 6 numbers

Test #6:

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

input:

0.25 0.80 10 5 63

output:

5.00000000000000000000
78.76953617596882395446
23.69238404399220598862
68.93872495177311066072
36.18858847313704529824
64.19812707970275766911
45.00040254843533205076
62.60860230087104127961
51.65247261396602596051
62.99999999418834306653

result:

ok 10 numbers

Test #7:

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

input:

0.25 0.99 3 18 30

output:

18.00000000000000000000
48.71999999522813595831
29.99999999880703427380

result:

ok 3 numbers

Test #8:

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

input:

0.28 0.64 9 6 10

output:

6.00000000000000000000
20.95040334097575396299
9.70611293547321096753
16.12596976015698047036
10.72718381154681033252
13.32423211373357396781
10.59618263123535975012
11.49443968953538863786
9.99999999706053976922

result:

ok 9 numbers

Test #9:

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

input:

0.31 0.40 7 10 49

output:

10.00000000000000000000
240.11506399801874067634
78.43566983938580960967
120.36108324941709213363
68.68620374307363363187
69.43715646011966668993
48.99999999986655296880

result:

ok 7 numbers

Test #10:

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

input:

0.32 0.28 5 36 6

output:

36.00000000000000000000
10.12137680845626164228
13.31884057870600557294
7.09601449155367625110
5.99999999933485828052

result:

ok 5 numbers

Test #11:

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

input:

0.35 0.65 10 86 82

output:

86.00000000000000000000
79.53392478157184086740
83.73687367355014998793
81.00495689376424479633
82.78070280062507890761
81.62646796116553105094
82.37672060681423147344
81.88905638714257406718
82.20603812992915493396
81.99999999711788234436

result:

ok 10 numbers

Test #12:

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

input:

0.36 0.68 8 72 59

output:

72.00000000000000000000
38.23991864010167773813
62.72637071043660483838
48.58463813102632400387
60.14440181026637333161
54.68953858079379415358
60.58642712006690089765
58.99999999816385809481

result:

ok 8 numbers

Test #13:

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

input:

0.43 0.61 2 93 84

output:

93.00000000000000000000
84.00000000000000000000

result:

ok 2 numbers

Test #14:

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

input:

0.46 0.96 6 65 35

output:

65.00000000000000000000
-16.61742367105034645647
54.75598511131683920894
9.23502642699741471688
56.81385786328297626824
34.99999998702768522207

result:

ok 6 numbers

Test #15:

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

input:

0.50 0.90 4 19 1

output:

19.00000000000000000000
-6.56521739983872976154
13.81739130008063654032
0.99999999018546148477

result:

ok 4 numbers

Test #16:

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

input:

0.54 0.35 3 16 22

output:

16.00000000000000000000
30.37037036847323179245
21.99999999897554658901

result:

ok 3 numbers

Test #17:

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

input:

0.55 0.89 10 74 13

output:

74.00000000000000000000
-48.32193708352860994637
39.28293460405926396106
-21.40090997210786483151
23.19131131295342029830
-6.29158865305161718595
17.17989330935015601654
3.84942741892664663794
17.40729012573129352859
12.99999997199692813865

result:

ok 10 numbers

Test #18:

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

input:

0.56 0.36 3 31 88

output:

31.00000000000000000000
137.21428570534044411033
87.99999999499065950204

result:

ok 3 numbers

Test #19:

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

input:

0.57 0.93 7 71 48

output:

71.00000000000000000000
-34.08056536500225774944
46.60407774194871421969
-5.13060147654133658079
40.41734945838374670757
18.26642981809528976100
47.99999999261120109395

result:

ok 7 numbers

Test #20:

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

input:

0.58 0.41 8 30 69

output:

30.00000000000000000000
89.43212167650926858187
64.17063057237537293531
73.88613561934650419971
69.16391719389487491298
70.40838757639109246611
69.19407084380372907617
68.99999999572651177004

result:

ok 8 numbers

Test #21:

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

input:

0.58 0.49 6 31 96

output:

31.00000000000000000000
99.55761353012348990887
72.93341584747162187341
91.08461182129404676289
88.56644862161164155623
95.99999999296882435829

result:

ok 6 numbers

Test #22:

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

input:

0.61 0.29 8 62 25

output:

62.00000000000000000000
34.40765125560574233532
38.96866726591950680358
33.74910589633655888520
31.88786810388195647192
29.23884025330559666145
27.08317430464217778763
24.99999999929034899537

result:

ok 8 numbers

Test #23:

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

input:

0.63 0.89 9 37 85

output:

37.00000000000000000000
-5.88785330364771652967
29.22065241870193830209
13.16882158353575249521
34.30273825027224887663
33.33097630701833224975
51.52795211616385273601
62.12717874642954996034
84.99999999363643610195

result:

ok 9 numbers

Test #24:

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

input:

0.64 0.67 2 74 42

output:

74.00000000000000000000
42.00000000000000000000

result:

ok 2 numbers

Test #25:

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

input:

0.65 0.56 2 94 96

output:

94.00000000000000000000
96.00000000000000000000

result:

ok 2 numbers

Test #26:

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

input:

0.65 0.90 10 97 23

output:

97.00000000000000000000
-61.70357628434430807829
47.19267541517619690694
-24.85797963604534999149
26.31572111022910220868
-5.26696295079189980015
20.26062308119145782825
8.42913834706173759059
23.71350069866244325567
22.99999996648615052663

result:

ok 10 numbers

Test #27:

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

input:

0.67 0.88 4 70 42

output:

70.00000000000000000000
0.54782150073151569813
61.96704040549011693884
41.99999999232211678191

result:

ok 4 numbers

Test #28:

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

input:

0.69 0.39 10 2 27

output:

2.00000000000000000000
22.36590768006863072515
16.21247629924735278450
19.90931264170743730801
20.06029147948459723239
21.60623305111027292469
22.73181448226507939125
24.11138288269591001267
25.50226183714355698839
26.99999999188045762821

result:

ok 10 numbers

Test #29:

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

input:

0.69 0.57 4 88 47

output:

88.00000000000000000000
11.84360959086916409433
58.33209061769971981448
46.99999999300822395298

result:

ok 4 numbers

Test #30:

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

input:

0.71 0.89 8 4 41

output:

4.00000000000000000000
6.83889035826723556966
8.41561215436973775184
12.06169704846035273249
16.05369972179591542272
22.13303717560481231885
30.00224914707778367529
40.99999998071351114959

result:

ok 8 numbers

Test #31:

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

input:

0.72 0.49 8 21 48

output:

21.00000000000000000000
19.94044236198533326387
24.64711850062943909734
27.51674207782600944938
31.88914236134315416393
36.44338611830181662299
41.86491776223545002722
47.99999998677741075426

result:

ok 8 numbers

Test #32:

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

input:

0.74 0.58 3 57 29

output:

57.00000000000000000000
-5.48648648873495403677
28.99999999833612918110

result:

ok 3 numbers

Test #33:

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

input:

0.76 0.70 2 91 18

output:

91.00000000000000000000
18.00000000000000000000

result:

ok 2 numbers

Test #34:

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

input:

0.77 0.36 10 31 25

output:

31.00000000000000000000
5.21497207955690100789
15.17552850125881391818
13.56254689460977047588
15.90635136930269588618
17.13040743642259400303
18.91670021899436804347
20.73280584573779705693
22.77427258005607768609
24.99999999110878690090

result:

ok 10 numbers

Test #35:

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

input:

0.77 0.96 8 78 68

output:

78.00000000000000000000
-40.09755701190442778170
44.00488110083358606062
-4.60989628378639082484
38.69506571828471663821
25.36970017064430038545
56.68193222094943450884
67.99999997394959905250

result:

ok 8 numbers

Test #36:

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

input:

0.78 0.52 7 73 77

output:

73.00000000000000000000
8.72754750162130221725
44.76748705126461658210
39.45696460082947965020
54.05552565530459219190
62.68093160356890791718
76.99999999154213981001

result:

ok 7 numbers

Test #37:

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

input:

0.78 0.69 4 42 97

output:

42.00000000000000000000
57.29790511395549401641
73.67236598888527510098
96.99999999995981170287

result:

ok 4 numbers

Test #38:

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

input:

0.78 0.70 10 54 99

output:

54.00000000000000000000
-13.01288635659147985280
27.64994864185864287265
12.45793949103570597003
29.07215685230890045432
31.39683998852593305173
44.84004498766645951946
56.95302308234799681941
75.81138949559795037203
98.99999996420999082147

result:

ok 10 numbers

Test #39:

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

input:

0.78 0.76 10 97 83

output:

97.00000000000000000000
-43.73473696432483848184
39.60690516782662484729
-2.34501406198210915477
28.27213695920219294067
20.27005614107130782031
37.29746787902928417680
44.49726761285703702242
63.05394432609074328866
82.99999996012212477581

result:

ok 10 numbers

Test #40:

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

input:

0.78 0.95 10 100 32

output:

100.00000000000000000000
-63.26957882265560328960
45.64972851832862943411
-24.49931163722649074543
24.25777901537553304934
-4.35327842337224879543
19.64933289437639984953
11.19086515540995563356
27.39574107087734589072
31.99999993292378519527

result:

ok 10 numbers

Test #41:

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

input:

0.79 0.90 10 98 42

output:

98.00000000000000000000
-58.24691463203635066748
42.18493744069128581486
-19.09612259068659767536
22.88050684997974570933
0.88909007986606169993
21.29483732807596041425
17.62310256105946848493
33.08760461850534539963
41.99999995357274684693

result:

ok 10 numbers

Test #42:

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

input:

0.81 0.48 10 97 1

output:

97.00000000000000000000
-38.25750168289232533425
15.57142363685720809485
-5.75074766193397657332
2.81617773952493788414
-0.47925490871310882923
0.96356883891435196610
0.55044840333833300328
0.90837624938293870525
0.99999999560258023834

result:

ok 10 numbers

Test #43:

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

input:

0.81 0.86 10 20 100

output:

20.00000000000000000000
-3.33284287080459762365
14.50039727464827521430
8.87907692357314992648
19.66239396429176977676
23.56254526534924309544
35.99532047422380998114
49.41999851232164076009
70.98617440281300616789
99.99999998687515301299

result:

ok 10 numbers

Test #44:

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

input:

0.84 0.85 10 74 95

output:

74.00000000000000000000
-36.29080488281033467501
32.41572389843931745190
-3.61797607569975809838
24.51426541008562054458
17.51670328012712474219
35.55115635387956274371
44.75216912536689051194
67.81030496610581792538
94.99999992809074456090

result:

ok 10 numbers

Test #45:

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

input:

0.88 0.37 10 3 96

output:

3.00000000000000000000
29.02182848629308864474
26.64920906793791743894
34.18938051971380787109
39.94686221248517909999
47.80330953928106652029
56.84725141318685359693
67.71280577313842741205
80.62075210324094598491
95.99999998691325231448

result:

ok 10 numbers

Test #46:

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

input:

0.91 0.50 10 100 98

output:

100.00000000000000000000
-22.58685785818670410663
29.44595934905009926297
15.50239407854223827599
28.83015828599848617841
33.98664107952974688942
45.34292252537131417967
58.25538003785277396673
75.68385709713167841528
97.99999997731622158881

result:

ok 10 numbers

Test #47:

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

input:

0.94 0.48 10 44 97

output:

44.00000000000000000000
-1.58274344357778318226
19.63222116303688125072
17.69457104033732974813
26.05636293617479282148
32.98637525936622694189
43.51424695316815416390
56.73685226047384588810
74.21947966236612614921
96.99999996765160403811

result:

ok 10 numbers

Test #48:

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

input:

0.94 0.54 10 28 95

output:

28.00000000000000000000
0.45254630094859749079
15.54539352289168263610
14.85704491403042304398
22.36013472155010717302
29.04133089183352822715
39.37332378796057241743
52.69324304227303912285
70.79324330523536445980
94.99999994974868400277

result:

ok 10 numbers

Test #49:

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

input:

0.95 0.57 10 2 94

output:

2.00000000000000000000
9.22728417208418250084
9.90591996347997394423
14.67017594339395714087
19.58304152540784315306
26.96588973687200763152
36.77992891951087273128
50.31148962355236875510
68.76047462649594876893
93.99999998059598738109

result:

ok 10 numbers

Test #50:

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

input:

0.98 0.90 10 21 99

output:

21.00000000000000000000
-8.21319348688120953739
10.85107038285641678499
3.24217483700619979459
12.94329468483685019464
15.60238614444569194006
26.93930363790994420015
40.44266509515286855958
63.87918506736876622654
98.99999995165896393701

result:

ok 10 numbers

Extra Test:

score: 0
Extra Test Passed