QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#436077#8795. Mysterious Sequenceucup-team1134#AC ✓1ms4024kbC++231.0kb2024-06-08 23:10:482024-06-08 23:10:50

Judging History

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

  • [2024-06-08 23:10:50]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:4024kb
  • [2024-06-08 23:10:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;

double dp[15][2];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    double A,B;cin>>A>>B;
    int N,x1,xn;cin>>N>>x1>>xn;
    
    dp[1][0]=x1;
    dp[1][1]=0;
    
    dp[2][0]=0;
    dp[2][1]=1;
    
    for(int i=3;i<=N;i++){
        for(int j=0;j<2;j++){
            dp[i][j]+=dp[i-2][j]*B;
            dp[i][j]+=dp[i-1][j]*A;
        }
    }
    
    double x2=(double)(xn-dp[N][0])/dp[N][1];
    
    for(int i=1;i<=N;i++){
        cout<<fixed<<setprecision(25)<<(dp[i][0]+dp[i][1]*x2)<<"\n";
    }
}


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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1.0 1.0 10 1 10

output:

1.0000000000000000000000000
-0.3235294117647058986797504
0.6764705882352941568314009
0.3529411764705882026404993
1.0294117647058822484495977
1.3823529411764705621123994
2.4117647058823528105619971
3.7941176470588233726743965
6.2058823529411757391471838
10.0000000000000000000000000

result:

ok 10 numbers

Test #2:

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

input:

1 1 2 1 100

output:

1.0000000000000000000000000
100.0000000000000000000000000

result:

ok 2 numbers

Test #3:

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

input:

1 1 5 50 100

output:

50.0000000000000000000000000
0.0000000000000000000000000
50.0000000000000000000000000
50.0000000000000000000000000
100.0000000000000000000000000

result:

ok 5 numbers

Test #4:

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

input:

0.25 0.25 10 1 1

output:

1.0000000000000000000000000
55.8755364806866978710786498
14.2188841201716744677696624
17.5236051502145926406228682
7.9356223175965672211873425
6.3648068669527901874971576
3.5751072961373391301265201
2.4849785407725324404282219
1.5150214592274677816163830
1.0000000000000000000000000

result:

ok 10 numbers

Test #5:

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

input:

0.25 0.63 6 93 12

output:

93.0000000000000000000000000
-14.2048079586650430883310037
55.0387980103337426385223807
4.8106704886244582297649686
35.8771103686663792586841737
12.0000000000000000000000000

result:

ok 6 numbers

Test #6:

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

input:

0.25 0.80 10 5 63

output:

5.0000000000000000000000000
78.7695361835313576648331946
23.6923840458828394162082986
68.9387249582957934990190552
36.1885884762802234604350815
64.1981270857066874668817036
45.0004025524508506350684911
62.6086023066780654744434287
51.6524726186302061137212149
63.0000000000000000000000000

result:

ok 10 numbers

Test #7:

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

input:

0.25 0.99 3 18 30

output:

18.0000000000000000000000000
48.7199999999999988631316228
30.0000000000000000000000000

result:

ok 3 numbers

Test #8:

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

input:

0.28 0.64 9 6 10

output:

6.0000000000000000000000000
20.9504033485078018372860242
9.7061129375821852960370961
16.1259697655680049876991689
10.7271838144116404833994238
13.3242321179987843748904197
10.5961826342631084685308451
11.4944396931128931527155146
10.0000000000000000000000000

result:

ok 9 numbers

Test #9:

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

input:

0.31 0.40 7 10 49

output:

10.0000000000000000000000000
240.1150639986882140419766074
78.4356698395933449319272768
120.3610832497492282300299848
68.6862037432595968766690930
69.4371564603101774082460906
49.0000000000000000000000000

result:

ok 7 numbers

Test #10:

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

input:

0.32 0.28 5 36 6

output:

36.0000000000000000000000000
10.1213768115941959990777832
13.3188405797101445671160036
7.0960144927536212833274476
6.0000000000000000000000000

result:

ok 5 numbers

Test #11:

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

input:

0.35 0.65 10 86 82

output:

86.0000000000000000000000000
79.5339247862308553749244311
83.7368736751807887230825145
81.0049568973633284940660815
82.7807028029446883010677993
81.6264679643168022948884754
82.3767206094249218040204141
81.8890563901046562023111619
82.2060381326628260012512328
82.0000000000000000000000000

result:

ok 10 numbers

Test #12:

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

input:

0.36 0.68 8 72 59

output:

72.0000000000000000000000000
38.2399186426056871823675465
62.7263707113380490909548826
48.5846381330535663778391609
60.1444018116091569936543237
54.6895385826557287600735435
60.5864271216502885408772272
59.0000000000000000000000000

result:

ok 8 numbers

Test #13:

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

input:

0.43 0.61 2 93 84

output:

93.0000000000000000000000000
84.0000000000000000000000000

result:

ok 2 numbers

Test #14:

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

input:

0.46 0.96 6 65 35

output:

65.0000000000000000000000000
-16.6174236628180516106567666
54.7559851151036980354547268
9.2350264366423715500786784
56.8138578713550401744214469
35.0000000000000000000000000

result:

ok 6 numbers

Test #15:

score: 0
Accepted
time: 1ms
memory: 3900kb

input:

0.50 0.90 4 19 1

output:

19.0000000000000000000000000
-6.5652173913043485597995641
13.8173913043478275852748993
1.0000000000000008881784197

result:

ok 4 numbers

Test #16:

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

input:

0.54 0.35 3 16 22

output:

16.0000000000000000000000000
30.3703703703703666860747035
22.0000000000000000000000000

result:

ok 3 numbers

Test #17:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

0.55 0.89 10 74 13

output:

74.0000000000000000000000000
-48.3219370765765177111461526
39.2829346078829075850080699
-21.4009099638174973279092228
23.1913113209161707573002786
-6.2915886412936714577881503
17.1798933229038794934240286
3.8494274368457581658731215
17.4072901476496326722553931
13.0000000000000000000000000

result:

ok 10 numbers

Test #18:

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

input:

0.56 0.36 3 31 88

output:

31.0000000000000000000000000
137.2142857142856939844932640
87.9999999999999857891452848

result:

ok 3 numbers

Test #19:

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

input:

0.57 0.93 7 71 48

output:

71.0000000000000000000000000
-34.0805653616860126930987462
46.6040777438389710596311488
-5.1306014723797872534305498
40.4173494625137692537464318
18.2664298243196370208352164
48.0000000000000000000000000

result:

ok 7 numbers

Test #20:

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

input:

0.58 0.41 8 30 69

output:

30.0000000000000000000000000
89.4321216828098215501086088
64.1706305760296942253262387
73.8861356240492455071944278
69.1639171981207425687898649
70.4083875807702099791640649
69.1940708480762225462967763
69.0000000000000000000000000

result:

ok 8 numbers

Test #21:

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

input:

0.58 0.49 6 31 96

output:

31.0000000000000000000000000
99.5576135384171863051960827
72.9334158522819677727966337
91.0846118281479562028835062
88.5664486279439842064675759
96.0000000000000000000000000

result:

ok 6 numbers

Test #22:

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

input:

0.61 0.29 8 62 25

output:

62.0000000000000000000000000
34.4076512571337289614348265
38.9686672668515754480722535
33.7491058973482438432256458
31.8878681047693817163235508
29.2388402541403102929962188
27.0831743054087077382519055
25.0000000000000000000000000

result:

ok 8 numbers

Test #23:

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

input:

0.63 0.89 9 37 85

output:

37.0000000000000000000000000
-5.8878533021768877375734519
29.2206524196285606365108833
13.1688215854285601835726993
34.3027382522894157546033966
33.3309763099737494940200122
51.5279521198210517241022899
62.1271787513638997779708006
85.0000000000000000000000000

result:

ok 9 numbers

Test #24:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

0.64 0.67 2 74 42

output:

74.0000000000000000000000000
42.0000000000000000000000000

result:

ok 2 numbers

Test #25:

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

input:

0.65 0.56 2 94 96

output:

94.0000000000000000000000000
96.0000000000000000000000000

result:

ok 2 numbers

Test #26:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

0.65 0.90 10 97 23

output:

97.0000000000000000000000000
-61.7035762791175628194650926
47.1926754185735788382771716
-24.8579796291329770951961109
26.3157211177797734080741066
-5.2669629396628039330607862
20.2606230952209784845763352
8.4291383661971224228182109
23.7135007237270656332839280
23.0000000000000000000000000

result:

ok 10 numbers

Test #27:

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

input:

0.67 0.88 4 70 42

output:

70.0000000000000000000000000
0.5478215065091387447893112
61.9670404093611253415474494
42.0000000000000000000000000

result:

ok 4 numbers

Test #28:

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

input:

0.69 0.39 10 2 27

output:

2.0000000000000000000000000
22.3659076870161328542963020
16.2124763040411323800071841
19.9093126477246684657984588
20.0602914855060596721614274
21.6062330576118029057397507
22.7318144890995093021501816
24.1113828899472650846291799
25.5022618448124198664572759
27.0000000000000000000000000

result:

ok 10 numbers

Test #29:

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

input:

0.69 0.57 4 88 47

output:

88.0000000000000000000000000
11.8436095975528186130532049
58.3320906223114405975138652
47.0000000000000000000000000

result:

ok 4 numbers

Test #30:

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

input:

0.71 0.89 8 4 41

output:

4.0000000000000000000000000
6.8388903626910737543198593
8.4156121575106617171968537
12.0616970546276256470719090
16.0536997289701020008578780
22.1330371861873587135960406
30.0022491609764152542538795
41.0000000000000000000000000

result:

ok 8 numbers

Test #31:

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

input:

0.72 0.49 8 21 48

output:

21.0000000000000000000000000
19.9404423699403103853455832
24.6471185063570246143171971
27.5167420858478060097240814
31.8891423699253593326830014
36.4433861284116815681954904
41.8649177737198385784722632
48.0000000000000000000000000

result:

ok 8 numbers

Test #32:

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

input:

0.74 0.58 3 57 29

output:

57.0000000000000000000000000
-5.4864864864864797411314612
29.0000000000000000000000000

result:

ok 3 numbers

Test #33:

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

input:

0.76 0.70 2 91 18

output:

91.0000000000000000000000000
18.0000000000000000000000000

result:

ok 2 numbers

Test #34:

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

input:

0.77 0.36 10 31 25

output:

31.0000000000000000000000000
5.2149720850264200677770532
15.1755285054703428215816530
13.5625468998216760496688948
15.9063513748320133345259819
17.1304074425564536454658082
18.9167002257079950311435823
20.7328058531154795218753861
22.7742725881537992904668499
25.0000000000000000000000000

result:

ok 10 numbers

Test #35:

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

input:

0.77 0.96 8 78 68

output:

78.0000000000000000000000000
-40.0975570076049834256082249
44.0048811041441609859248274
-4.6098962771097831137012690
38.6950657266038575698985369
25.3697001834595710079156561
56.6819322388035971016506664
67.9999999999999715782905696

result:

ok 8 numbers

Test #36:

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

input:

0.78 0.52 7 73 77

output:

73.0000000000000000000000000
8.7275475060529341675419346
44.7674870547212861993102706
39.4569646058301373159338254
54.0555256610025693930765556
62.6809316106136762414280383
77.0000000000000000000000000

result:

ok 7 numbers

Test #37:

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

input:

0.78 0.69 4 42 97

output:

42.0000000000000000000000000
57.2979051139864452579786303
73.6723659889094335539994063
97.0000000000000000000000000

result:

ok 4 numbers

Test #38:

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

input:

0.78 0.70 10 54 99

output:

54.0000000000000000000000000
-13.0128863508996897024871942
27.6499486462982382306563522
12.4579394984828439874036121
29.0721568612253840058201604
31.3968400006937891077996028
44.8400450033989130815825774
56.9530231031368074923193490
75.8113895228259480063570663
99.0000000000000000000000000

result:

ok 10 numbers

Test #39:

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

input:

0.78 0.76 10 97 83

output:

97.0000000000000000000000000
-43.7347369590404895234314608
39.6069051719484193085918378
-2.3450140547510045507806353
28.2721369679750154091379954
20.2700561534097403182386188
37.2974678953206364440120524
44.4972676349414939522830537
63.0539443556980359062436037
83.0000000000000000000000000

result:

ok 10 numbers

Test #40:

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

input:

0.78 0.95 10 100 32

output:

100.0000000000000000000000000
-63.2695788173641275875525025
45.6497285224559803396005009
-24.4993116289802514984330628
24.2577790257285954567123554
-4.3532784074629660153732402
19.6493329166210628500266466
11.1908651878746923102880828
27.3957411173322498143534176
32.0000000000000000000000000

result:

ok 10 numbers

Test #41:

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

input:

0.79 0.90 10 98 42

output:

98.0000000000000000000000000
-58.2469146280413667682296364
42.1849374438473176951447385
-19.0961225845978503912192537
22.8805068576303085592371644
0.8890900913898747148778057
21.2948373440652574117848417
17.6231025840624511147325393
33.0876046510680907886126079
42.0000000000000000000000000

result:

ok 10 numbers

Test #42:

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

input:

0.81 0.48 10 97 1

output:

97.0000000000000000000000000
-38.2575016815992228202958358
15.5714236379046226943501097
-5.7507476604648815055043087
2.8161777412176718371483730
-0.4792549066368323451570177
0.9635688414086445163775352
0.5504484063553292116921511
0.9083762530239738453019527
1.0000000000000000000000000

result:

ok 10 numbers

Test #43:

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

input:

0.81 0.86 10 20 100

output:

20.0000000000000000000000000
-3.3328428696514023066299615
14.5003972755823635765182189
8.8790769253215096057374467
19.6623939665112565933213773
23.5625452686506164923230244
35.9953204788066756236730726
49.4199985188729442597832531
70.9861744120608335606448236
100.0000000000000000000000000

result:

ok 10 numbers

Test #44:

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

input:

0.84 0.85 10 74 95

output:

74.0000000000000000000000000
-36.2908048770982958330932888
32.4157239032374349108067690
-3.6179760668141085488969111
24.5142654216279680667867069
17.5167032973755141256333445
35.5511563781792006011528429
44.7521691604397062747011660
67.8103050162216050011920743
95.0000000000000000000000000

result:

ok 10 numbers

Test #45:

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

input:

0.88 0.37 10 3 96

output:

3.0000000000000000000000000
29.0218284903764178750407154
26.6492090715312457405161695
34.1893805243867703325122420
39.9468622179269203797957744
47.8033095457988110865699127
56.8472514209359189862880157
67.7128057823691591465831152
80.6207521142311520634393673
96.0000000000000000000000000

result:

ok 10 numbers

Test #46:

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

input:

0.91 0.50 10 100 98

output:

100.0000000000000000000000000
-22.5868578544844282873782504
29.4459593524191696189973300
15.5023940834592295345828461
28.8301582921574848228374321
33.9866410875929290114072501
45.3429225357883041169770877
58.2553800513638151414852473
75.6838571146352450114136445
98.0000000000000000000000000

result:

ok 10 numbers

Test #47:

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

input:

0.94 0.48 10 44 97

output:

44.0000000000000000000000000
-1.5827434387177976571337013
19.6322211676052660322966403
17.6945710469644055251592363
26.0563629445970690312606166
32.9863752704641584045930358
43.5142469676429044511678512
56.7368522794071168391383253
74.2194796871112743019693880
97.0000000000000000000000000

result:

ok 10 numbers

Test #48:

score: 0
Accepted
time: 1ms
memory: 3908kb

input:

0.94 0.54 10 28 95

output:

28.0000000000000000000000000
0.4525463071458427077864428
15.5453935287170939005818582
14.8570449228528218554856721
22.3601347329888824333465891
29.0413309073500727208738681
39.3733238087230645874114998
52.6932430701687124496856995
70.7932433426690437272554846
95.0000000000000000000000000

result:

ok 10 numbers

Test #49:

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

input:

0.95 0.57 10 2 94

output:

2.0000000000000000000000000
9.2272841741610633903292182
9.9059199654530107892469459
14.6701759464521650500046235
19.5830415294377750967669272
26.9658897424436148071436037
36.7799289271009612889429263
50.3114896339387769330642186
68.7604746406893667654003366
94.0000000000000000000000000

result:

ok 10 numbers

Test #50:

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

input:

0.98 0.90 10 21 99

output:

21.0000000000000000000000000
-8.2131934849701782042075138
10.8510703847292280244118956
3.2421748405614838617339046
12.9432946900065566353532631
15.6023861527117659875329991
26.9393036506634331317400211
40.4426651150907474630002980
63.8791850983860172163986135
99.0000000000000000000000000

result:

ok 10 numbers

Extra Test:

score: 0
Extra Test Passed