QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#684491 | #8795. Mysterious Sequence | ideograph_advantage# | AC ✓ | 0ms | 4012kb | C++14 | 1.1kb | 2024-10-28 13:54:29 | 2024-10-28 13:54:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define iter(v) v.begin(), v.end()
#define SZ(v) int(v.size())
#define pb emplace_back
#define ff first
#define ss second
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#ifdef zisk
void debug(){ cerr << "\n"; }
template<class T, class ... U>
void debug(T a, U ... b){ cerr << a << " ", debug(b...); }
template<class T> void pary(T l, T r) {
while (l != r) cerr << *l << " ", l++;
cerr << "\n";
}
#else
#define debug(...) void()
#define pary(...) void()
#endif
template<class A, class B>
ostream &operator<<(ostream &o, pair<A, B> p) {
return o << '(' << p.ff << ',' << p.ss << ')';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
double a,b;
int n;
cin >> a >> b >> n;
vector<double> x(n);
cin >> x[0] >> x[n-1];
cout << fixed << setprecision(20);
if(n==2){
for(auto h:x){
cout << h << "\n";
}
return 0;
}
double l=-1e9,r=1e9;
for(int w=0;w<100;w++){
double m=(l+r)/2;
x[1]=m;
for(int i=2;i<n-1;i++){
x[i]=a*x[i-1]+b*x[i-2];
}
if(x[n-1]>=a*x[n-2]+b*x[n-3]){
l=m;
}
else{
r=m;
}
}
for(auto h:x){
cout << h << "\n";
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3944kb
input:
1.0 1.0 10 1 10
output:
1.00000000000000000000 -0.32352941176470595419 0.67647058823529404581 0.35294117647058809162 1.02941176470588224845 1.38235294117647034007 2.41176470588235236647 3.79411764705882248450 6.20588235294117485097 10.00000000000000000000
result:
ok 10 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
1 1 2 1 100
output:
1.00000000000000000000 100.00000000000000000000
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
1 1 5 50 100
output:
50.00000000000000000000 0.00000000000000355271 50.00000000000000000000 50.00000000000000000000 100.00000000000000000000
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.25 0.25 10 1 1
output:
1.00000000000000000000 55.87553648068671918736 14.21888412017167979684 17.52360515021459974605 7.93562231759656988572 6.36480686695279196385 3.57510729613734046239 2.48497854077253332861 1.51502145922746844775 1.00000000000000000000
result:
ok 10 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.25 0.63 6 93 12
output:
93.00000000000000000000 -14.20480795866504308833 55.03879801033374263852 4.81067048862445822976 35.87711036866637215326 12.00000000000000000000
result:
ok 6 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
0.25 0.80 10 5 63
output:
5.00000000000000000000 78.76953618353135766483 23.69238404588283941621 68.93872495829579349902 36.18858847628021635501 64.19812708570668746688 45.00040255245085063507 62.60860230667806547444 51.65247261863019900829 63.00000000000000000000
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.72000000000001307399 30.00000000000000000000
result:
ok 3 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
0.28 0.64 9 6 10
output:
6.00000000000000000000 20.95040334850780539000 9.70611293758218707239 16.12596976556800854041 10.72718381441164225976 13.32423211799878615125 10.59618263426311202124 11.49443969311289492907 10.00000000000000000000
result:
ok 9 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
0.31 0.40 7 10 49
output:
10.00000000000000000000 240.11506399868829930710 78.43566983959337335364 120.36108324974927086259 68.68620374325962529838 69.43715646031019161910 49.00000000000000000000
result:
ok 7 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
0.32 0.28 5 36 6
output:
36.00000000000000000000 10.12137681159419955179 13.31884057971014634347 7.09601449275362305968 6.00000000000000000000
result:
ok 5 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
0.35 0.65 10 86 82
output:
86.00000000000000000000 79.53392478623086958578 83.73687367518080293394 81.00495689736334270492 82.78070280294468830107 81.62646796431681650574 82.37672060942493601488 81.88905639010465620231 82.20603813266284021211 82.00000000000000000000
result:
ok 10 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
0.36 0.68 8 72 59
output:
72.00000000000000000000 38.23991864260570139322 62.72637071133804909095 48.58463813305357348327 60.14440181160915699365 54.68953858265572876007 60.58642712165029564630 59.00000000000000000000
result:
ok 8 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3788kb
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: 4008kb
input:
0.46 0.96 6 65 35
output:
65.00000000000000000000 -16.61742366281804095252 54.75598511510369803545 9.23502643664238398458 56.81385787135504727985 35.00000000000000000000
result:
ok 6 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
0.50 0.90 4 19 1
output:
19.00000000000000000000 -6.56521739130434767162 13.81739130434782758527 1.00000000000000000000
result:
ok 4 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.54 0.35 3 16 22
output:
16.00000000000000000000 30.37037037037037379150 22.00000000000000000000
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.32193707657651771115 39.28293460788290758501 -21.40090996381749732791 23.19131132091616720459 -6.29158864129368033957 17.17989332290386172986 3.84942743684574839591 17.40729014764959714512 13.00000000000000000000
result:
ok 10 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.56 0.36 3 31 88
output:
31.00000000000000000000 137.21428571428572240620 88.00000000000000000000
result:
ok 3 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.57 0.93 7 71 48
output:
71.00000000000000000000 -34.08056536168601269310 46.60407774383897105963 -5.13060147237978014800 40.41734946251377635917 18.26642982431965478440 48.00000000000000000000
result:
ok 7 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.58 0.41 8 30 69
output:
30.00000000000000000000 89.43212168280984997182 64.17063057602970843618 73.88613562404927392890 69.16391719812075677964 70.40838758077023840087 69.19407084807623675715 69.00000000000000000000
result:
ok 8 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
0.58 0.49 6 31 96
output:
31.00000000000000000000 99.55761353841720051605 72.93341585228196777280 91.08461182814797041374 88.56644862794398420647 96.00000000000000000000
result:
ok 6 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
0.61 0.29 8 62 25
output:
62.00000000000000000000 34.40765125713373606686 38.96866726685158255350 33.74910589734825094865 31.88786810476939237446 29.23884025414032095114 27.08317430540871839639 25.00000000000000000000
result:
ok 8 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 4012kb
input:
0.63 0.89 9 37 85
output:
37.00000000000000000000 -5.88785330217687885579 29.22065241962856418922 13.16882158542857261807 34.30273825228942286003 33.33097630997376370487 51.52795211982105882953 62.12717875136391398883 85.00000000000000000000
result:
ok 9 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3800kb
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: 3720kb
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: 3924kb
input:
0.65 0.90 10 97 23
output:
97.00000000000000000000 -61.70357627911755571404 47.19267541857358594370 -24.85797962913296998977 26.31572111777979827707 -5.26696293966280393306 20.26062309522099624814 8.42913836619712419918 23.71350072372702655343 23.00000000000000000000
result:
ok 10 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
0.67 0.88 4 70 42
output:
70.00000000000000000000 0.54782150650914451795 61.96704040936112534155 42.00000000000000000000
result:
ok 4 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
0.69 0.39 10 2 27
output:
2.00000000000000000000 22.36590768701613285430 16.21247630404113238001 19.90931264772467557123 20.06029148550606677759 21.60623305761181001117 22.73181448909951285486 24.11138288994726863734 25.50226184481242341917 27.00000000000000000000
result:
ok 10 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.69 0.57 4 88 47
output:
88.00000000000000000000 11.84360959755282394212 58.33209062231144059751 47.00000000000000000000
result:
ok 4 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 4012kb
input:
0.71 0.89 8 4 41
output:
4.00000000000000000000 6.83889036269107464250 8.41561215751066349355 12.06169705462762742343 16.05369972897010555357 22.13303718618736226631 30.00224916097641880697 41.00000000000000000000
result:
ok 8 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
0.72 0.49 8 21 48
output:
21.00000000000000000000 19.94044236994030683263 24.64711850635701750889 27.51674208584780245701 31.88914236992535222726 36.44338612841167446277 41.86491777371982436762 48.00000000000000000000
result:
ok 8 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
0.74 0.58 3 57 29
output:
57.00000000000000000000 -5.48648648648647707660 29.00000000000000000000
result:
ok 3 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3992kb
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: 3868kb
input:
0.77 0.36 10 31 25
output:
31.00000000000000000000 5.21497208502642095596 15.17552850547034459794 13.56254689982167782603 15.90635137483201511088 17.13040744255645364547 18.91670022570799503114 20.73280585311547952188 22.77427258815379573775 25.00000000000000000000
result:
ok 10 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
0.77 0.96 8 78 68
output:
78.00000000000000000000 -40.09755700760497632018 44.00488110414416098592 -4.60989627710977600827 38.69506572660386467533 25.36970018345959232420 56.68193223880359710165 68.00000000000000000000
result:
ok 8 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.78 0.52 7 73 77
output:
73.00000000000000000000 8.72754750605292528576 44.76748705472128619931 39.45696460583013021051 54.05552566100257649850 62.68093161061368334686 77.00000000000000000000
result:
ok 7 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
0.78 0.69 4 42 97
output:
42.00000000000000000000 57.29790511398645946883 73.67236598890943355400 97.00000000000000000000
result:
ok 4 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
0.78 0.70 10 54 99
output:
54.00000000000000000000 -13.01288635089969858427 27.64994864629823112523 12.45793949848283332926 29.07215686122537334768 31.39684000069377134423 44.84004500339889887073 56.95302310313677907061 75.81138952282591958465 99.00000000000000000000
result:
ok 10 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.78 0.76 10 97 83
output:
97.00000000000000000000 -43.73473695904048952343 39.60690517194841930859 -2.34501405475100099807 28.27213696797501896185 20.27005615340975452909 37.29746789532062223316 44.49726763494150105771 63.05394435569805011710 83.00000000000000000000
result:
ok 10 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.78 0.95 10 100 32
output:
100.00000000000000000000 -63.26957881736413469298 45.64972852245597323417 -24.49931162898026570929 24.25777902572856348229 -4.35327840746296956809 19.64933291662101666475 11.19086518787457151802 27.39574111733212902209 32.00000000000000000000
result:
ok 10 numbers
Test #41:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.79 0.90 10 98 42
output:
98.00000000000000000000 -58.24691462804136676823 42.18493744384731769514 -19.09612258459785039122 22.88050685763028724296 0.88909009138986050402 21.29483734406524675364 17.62310258406241914031 33.08760465106803394519 42.00000000000000000000
result:
ok 10 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
0.81 0.48 10 97 1
output:
97.00000000000000000000 -38.25750168159920860944 15.57142363790463335249 -5.75074766046486374194 2.81617774121768338347 -0.47925490663681102887 0.96356884140867105071 0.55044840635535430273 0.90837625302399915839 1.00000000000000000000
result:
ok 10 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
0.81 0.86 10 20 100
output:
20.00000000000000000000 -3.33284286965140097436 14.50039727558236535288 8.87907692532151138209 19.66239396651126014604 23.56254526865062359775 35.99532047880668983453 49.41999851887295847064 70.98617441206084777150 100.00000000000000000000
result:
ok 10 numbers
Test #44:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.84 0.85 10 74 95
output:
74.00000000000000000000 -36.29080487709828162224 32.41572390323744201623 -3.61797606681409078533 24.51426542162798938307 17.51670329737553188920 35.55115637817923612829 44.75216916043975601269 67.81030501622174710974 95.00000000000000000000
result:
ok 10 numbers
Test #45:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
0.88 0.37 10 3 96
output:
3.00000000000000000000 29.02182849037642142775 26.64920907153124929323 34.18938052438677743794 39.94686221792692748522 47.80330954579880398114 56.84725142093591188086 67.71280578236915914658 80.62075211423115206344 96.00000000000000000000
result:
ok 10 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
0.91 0.50 10 100 98
output:
100.00000000000000000000 -22.58685785448442118195 29.44595935241917672442 15.50239408345924019272 28.83015829215749903369 33.98664108759294322226 45.34292253578833253869 58.25538005136385777405 75.68385711463528764398 98.00000000000000000000
result:
ok 10 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
0.94 0.48 10 44 97
output:
44.00000000000000000000 -1.58274343871779743509 19.63222116760526958501 17.69457104696440907787 26.05636294459706903126 32.98637527046415840459 43.51424696764289734574 56.73685227940711683914 74.21947968711127430197 97.00000000000000000000
result:
ok 10 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 3948kb
input:
0.94 0.54 10 28 95
output:
28.00000000000000000000 0.45254630714584442863 15.54539352871709390058 14.85704492285282363184 22.36013473298888243335 29.04133090735007272087 39.37332380872306458741 52.69324307016871955511 70.79324334266904372726 95.00000000000000000000
result:
ok 10 numbers
Test #49:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
0.95 0.57 10 2 94
output:
2.00000000000000000000 9.22728417416105983762 9.90591996545300723653 14.67017594645215972093 19.58304152943776443863 26.96588974244360770172 36.77992892710095418352 50.31148963393876272221 68.76047464068936676540 94.00000000000000000000
result:
ok 10 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.98 0.90 10 21 99
output:
21.00000000000000000000 -8.21319348497017642785 10.85107038472922980077 3.24217484056148652627 12.94329469000656374078 15.60238615271177131660 26.93930365066344378988 40.44266511509076877928 63.87918509838605984896 99.00000000000000000000
result:
ok 10 numbers
Extra Test:
score: 0
Extra Test Passed