QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#548993 | #8795. Mysterious Sequence | ucup-team139 | AC ✓ | 1ms | 4040kb | C++23 | 579b | 2024-09-05 22:56:50 | 2024-09-05 22:56:51 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
double a,b;
int n,x1,xn;
cin>>a>>b>>n>>x1>>xn;
vector<pair<double,double>> v(n);
v[0]={x1,0.0};
v[1]={0.0,1.0};
for(int i=2;i<n;i++){
v[i].first=a*v[i-1].first+b*v[i-2].first;
v[i].second=a*v[i-1].second+b*v[i-2].second;
}
double x2 = (xn-v.back().first)/v.back().second;
vector<double> sol(n);
sol[0]=x1;
sol[1]=x2;
for(int i=2;i<n;i++){
sol[i]=a*sol[i-1]+b*sol[i-2];
}
assert(abs(sol.back()-xn)<1e-9);
for(auto i : sol)cout<<setprecision(20)<<i<<"\n";
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3740kb
input:
1.0 1.0 10 1 10
output:
1 -0.32352941176470589868 0.67647058823529415683 0.35294117647058825815 1.0294117647058824705 1.3823529411764707842 2.4117647058823532547 3.7941176470588242609 6.2058823529411775155 10.000000000000001776
result:
ok 10 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 4024kb
input:
1 1 2 1 100
output:
1 100
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 4028kb
input:
1 1 5 50 100
output:
50 0 50 50 100
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.25 0.25 10 1 1
output:
1 55.875536480686697871 14.218884120171674468 17.523605150214592641 7.935622317596566333 6.3648068669527901875 3.5751072961373391301 2.4849785407725324404 1.5150214592274680037 1
result:
ok 10 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
0.25 0.63 6 93 12
output:
93 -14.204807958665043088 55.038798010333742639 4.8106704886244582298 35.877110368666372153 12.000000000000001776
result:
ok 6 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.25 0.80 10 5 63
output:
5 78.769536183531357665 23.692384045882839416 68.938724958295793499 36.188588476280216355 64.198127085706687467 45.000402552450850635 62.608602306678065474 51.652472618630199008 63
result:
ok 10 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
0.25 0.99 3 18 30
output:
18 48.719999999999998863 30
result:
ok 3 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
0.28 0.64 9 6 10
output:
6 20.950403348507801837 9.706112937582185296 16.125969765568004988 10.727183814411640483 13.324232117998782599 10.596182634263108469 11.494439693112891376 10
result:
ok 9 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
0.31 0.40 7 10 49
output:
10 240.11506399868821404 78.435669839593344932 120.36108324974921402 68.686203743259596877 69.437156460310163197 48.999999999999992895
result:
ok 7 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.32 0.28 5 36 6
output:
36 10.121376811594195999 13.318840579710144567 7.0960144927536212833 6
result:
ok 5 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.35 0.65 10 86 82
output:
86 79.533924786230855375 83.736873675180788723 81.004956897363328494 82.78070280294467409 81.626467964316802295 82.376720609424921804 81.889056390104641991 82.206038132662826001 82
result:
ok 10 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.36 0.68 8 72 59
output:
72 38.239918642605687182 62.726370711338049091 48.584638133053559272 60.144401811609156994 54.689538582655714549 60.586427121650288541 58.999999999999992895
result:
ok 8 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
0.43 0.61 2 93 84
output:
93 84
result:
ok 2 numbers
Test #14:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
0.46 0.96 6 65 35
output:
65 -16.617423662818051611 54.755985115103698035 9.2350264366423751028 56.813857871355040174 35
result:
ok 6 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.50 0.90 4 19 1
output:
19 -6.5652173913043485598 13.817391304347827585 1
result:
ok 4 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.54 0.35 3 16 22
output:
16 30.370370370370366686 22
result:
ok 3 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
0.55 0.89 10 74 13
output:
74 -48.321937076576517711 39.282934607882907585 -21.400909963817497328 23.191311320916167205 -6.2915886412936803396 17.17989332290386173 3.8494274368457483959 17.407290147649597145 12.999999999999996447
result:
ok 10 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 4040kb
input:
0.56 0.36 3 31 88
output:
31 137.21428571428569398 87.999999999999985789
result:
ok 3 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.57 0.93 7 71 48
output:
71 -34.080565361686012693 46.60407774383897106 -5.130601472379780148 40.417349462513776359 18.266429824319654784 48.000000000000014211
result:
ok 7 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.58 0.41 8 30 69
output:
30 89.43212168280982155 64.170630576029694225 73.886135624049245507 69.163917198120728358 70.408387580770209979 69.194070848076222546 68.999999999999985789
result:
ok 8 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.58 0.49 6 31 96
output:
31 99.557613538417186305 72.933415852281967773 91.084611828147956203 88.566448627943969996 96
result:
ok 6 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
0.61 0.29 8 62 25
output:
62 34.407651257133728961 38.968667266851575448 33.749105897348243843 31.887868104769381716 29.238840254140310293 27.083174305408707738 25
result:
ok 8 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 4028kb
input:
0.63 0.89 9 37 85
output:
37 -5.8878533021768877376 29.220652419628560637 13.168821585428563736 34.302738252289415755 33.330976309973756599 51.527952119821051724 62.127178751363906883 85
result:
ok 9 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.64 0.67 2 74 42
output:
74 42
result:
ok 2 numbers
Test #25:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.65 0.56 2 94 96
output:
94 96
result:
ok 2 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
0.65 0.90 10 97 23
output:
97 -61.703576279117562819 47.192675418573578838 -24.857979629132980648 26.315721117779784066 -5.2669629396628216966 20.260623095220971379 8.4291383661970922248 23.713500723726983921 22.99999999999992184
result:
ok 10 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.67 0.88 4 70 42
output:
70 0.54782150650913874479 61.967040409361125342 42
result:
ok 4 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.69 0.39 10 2 27
output:
2 22.365907687016132854 16.21247630404113238 19.909312647724675571 20.060291485506066778 21.606233057611810011 22.731814489099512855 24.111382889947268637 25.502261844812423419 27.000000000000007105
result:
ok 10 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
0.69 0.57 4 88 47
output:
88 11.843609597552818613 58.332090622311440598 46.999999999999992895
result:
ok 4 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
0.71 0.89 8 4 41
output:
4 6.8388903626910737543 8.4156121575106617172 12.061697054627625647 16.053699728970102001 22.133037186187358714 30.002249160976415254 41
result:
ok 8 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.72 0.49 8 21 48
output:
21 19.940442369940310385 24.647118506357024614 27.516742085847809562 31.889142369925366438 36.443386128411688674 41.864917773719845684 48.000000000000014211
result:
ok 8 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 4028kb
input:
0.74 0.58 3 57 29
output:
57 -5.4864864864864797411 29
result:
ok 3 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.76 0.70 2 91 18
output:
91 18
result:
ok 2 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
0.77 0.36 10 31 25
output:
31 5.2149720850264200678 15.175528505470342822 13.56254689982167605 15.906351374832015111 17.130407442556453645 18.916700225707995031 20.732805853115479522 22.774272588153795738 24.999999999999992895
result:
ok 10 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.77 0.96 8 78 68
output:
78 -40.097557007604983426 44.004881104144160986 -4.6098962771097831137 38.69506572660385757 25.369700183459581666 56.681932238803582891 67.999999999999957367
result:
ok 8 numbers
Test #36:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
0.78 0.52 7 73 77
output:
73 8.7275475060529341675 44.767487054721286199 39.456964605830130211 54.055525661002576499 62.680931610613683347 77.000000000000014211
result:
ok 7 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.78 0.69 4 42 97
output:
42 57.297905113986445258 73.672365988909433554 97
result:
ok 4 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.78 0.70 10 54 99
output:
54 -13.012886350899689702 27.649948646298238231 12.457939498482842211 29.072156861225380453 31.396840000693785555 44.840045003398920187 56.953023103136814598 75.811389522825962217 99.000000000000014211
result:
ok 10 numbers
Test #39:
score: 0
Accepted
time: 1ms
memory: 4040kb
input:
0.78 0.76 10 97 83
output:
97 -43.734736959040489523 39.606905171948419309 -2.3450140547510009981 28.272136967975018962 20.270056153409754529 37.297467895320622233 44.497267634941501058 63.053944355698050117 83.000000000000028422
result:
ok 10 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.78 0.95 10 100 32
output:
100 -63.269578817364127588 45.64972852245598034 -24.499311628980251498 24.257779025728581246 -4.3532784074629446991 19.649332916621055745 11.190865187874628361 27.395741117332214287 32.000000000000028422
result:
ok 10 numbers
Test #41:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.79 0.90 10 98 42
output:
98 -58.246914628041366768 42.184937443847317695 -19.096122584597850391 22.880506857630287243 0.88909009138986050402 21.294837344065246754 17.62310258406241914 33.087604651068033945 41.999999999999928946
result:
ok 10 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.81 0.48 10 97 1
output:
97 -38.25750168159922282 15.571423637904622694 -5.7507476604648797291 2.8161777412176656199 -0.47925490663683278925 0.96356884140864473842 0.55044840635532255035 0.90837625302396074467 0.9999999999999631406
result:
ok 10 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.81 0.86 10 20 100
output:
20 -3.3328428696514023066 14.500397275582363577 8.8790769253215096057 19.662393966511253041 23.56254526865061294 35.995320478806675624 49.419998518872937154 70.98617441206081935 100
result:
ok 10 numbers
Test #44:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
0.84 0.85 10 74 95
output:
74 -36.290804877098295833 32.415723903237434911 -3.6179760668141049962 24.51426542162797162 17.51670329737550702 35.551156378179200601 44.752169160439706275 67.810305016221661845 94.999999999999943157
result:
ok 10 numbers
Test #45:
score: 0
Accepted
time: 0ms
memory: 4036kb
input:
0.88 0.37 10 3 96
output:
3 29.021828490376417875 26.649209071531245741 34.189380524386770333 39.94686221792692038 47.803309545798796876 56.84725142093589767 67.712805782369144936 80.620752114231123642 95.999999999999971578
result:
ok 10 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 4036kb
input:
0.91 0.50 10 100 98
output:
100 -22.586857854484428287 29.445959352419169619 15.502394083459229535 28.830158292157484823 33.986641087592929011 45.342922535788304117 58.255380051363822247 75.683857114635230801 97.999999999999971578
result:
ok 10 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.94 0.48 10 44 97
output:
44 -1.5827434387177976571 19.632221167605266032 17.694571046964405525 26.056362944597065479 32.986375270464151299 43.51424696764289024 56.736852279407102628 74.219479687111260091 96.999999999999985789
result:
ok 10 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
0.94 0.54 10 28 95
output:
28 0.45254630714584270779 15.545393528717093901 14.857044922852821855 22.360134732988882433 29.041330907350072721 39.373323808723064587 52.693243070168719555 70.793243342669043727 95
result:
ok 10 numbers
Test #49:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
0.95 0.57 10 2 94
output:
2 9.2272841741610633903 9.9059199654530107892 14.67017594645216505 19.583041529437771544 26.965889742443614807 36.779928927100961289 50.311489633938776933 68.760474640689380976 94.000000000000014211
result:
ok 10 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
0.98 0.90 10 21 99
output:
21 -8.2131934849701782042 10.851070384729228024 3.2421748405614829736 12.943294690006558412 15.602386152711762435 26.939303650663429579 40.442665115090747463 63.879185098386017216 98.999999999999971578
result:
ok 10 numbers
Extra Test:
score: 0
Extra Test Passed