QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#435788 | #8795. Mysterious Sequence | ucup-team1198# | AC ✓ | 0ms | 3980kb | C++20 | 1.1kb | 2024-06-08 21:31:54 | 2024-06-08 21:31:56 |
Judging History
answer
#include <map>
#include <set>
#include <array>
#include <cmath>
#include <deque>
#include <bitset>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ld = long double;
const ld INF = 1e9;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ld a, b, x1, xn;
int n;
cin >> a >> b >> n >> x1 >> xn;
ld L = -INF, R = INF;
for (int _ = 0; _ < 100; ++_) {
ld m = (L + R) / 2;
ld xi1 = x1;
ld xi = m;
for (int i = 3; i <= n; ++i) {
ld x3 = a * xi + b * xi1;
xi1 = xi;
xi = x3;
}
if (xi > xn) {
R = m;
} else {
L = m;
}
}
ld x2 = (L + R) / 2;
cout << fixed << setprecision(20);
cout << x1 << "\n" << x2 << "\n";
for (int i = 3; i <= n; ++i) {
ld x3 = a * x2 + b * x1;
cout << x3 << "\n";
x1 = x2;
x2 = x3;
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3868kb
input:
1.0 1.0 10 1 10
output:
1.00000000000000000000 -0.32352941176470588236 0.67647058823529411764 0.35294117647058823527 1.02941176470588235297 1.38235294117647058824 2.41176470588235294110 3.79411764705882352923 6.20588235294117647033 10.00000000000000000000
result:
ok 10 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
1 1 2 1 100
output:
1.00000000000000000000 100.00000000000000000000
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
1 1 5 50 100
output:
50.00000000000000000000 0.00000000000000000173 50.00000000000000000000 50.00000000000000000000 100.00000000000000000000
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
0.25 0.25 10 1 1
output:
1.00000000000000000000 55.87553648068669528287 14.21888412017167382072 17.52360515021459227633 7.93562231759656652426 6.36480686695278970004 3.57510729613733905597 2.48497854077253218889 1.51502145922746781122 1.00000000000000000000
result:
ok 10 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
0.25 0.63 6 93 12
output:
93.00000000000000000000 -14.20480795866504474152 55.03879801033373881519 4.81067048862445651673 35.87711036866636958240 12.00000000000000000087
result:
ok 6 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
0.25 0.80 10 5 63
output:
5.00000000000000000000 78.76953618353135544439 23.69238404588283886110 68.93872495829579406801 36.18858847628021960588 64.19812708570669015917 45.00040255245084822727 62.60860230667806418381 51.65247261863019462985 63.00000000000000000694
result:
ok 10 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.25 0.99 3 18 30
output:
18.00000000000000000000 48.72000000000000000805 30.00000000000000000173
result:
ok 3 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
0.28 0.64 9 6 10
output:
6.00000000000000000000 20.95040334850780511244 9.70611293758218543135 16.12596976556800719253 10.72718381441164068983 13.32423211799878399585 10.59618263426310956054 11.49443969311289243454 10.00000000000000000000
result:
ok 9 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
0.31 0.40 7 10 49
output:
10.00000000000000000000 240.11506399868826394650 78.43566983959336182120 120.36108324974924774220 68.68620374325961153161 69.43715646031017867112 49.00000000000000000000
result:
ok 7 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
0.32 0.28 5 36 6
output:
36.00000000000000000000 10.12137681159420289981 13.31884057971014492794 7.09601449275362318892 6.00000000000000000043
result:
ok 5 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.35 0.65 10 86 82
output:
86.00000000000000000000 79.53392478623083201861 83.73687367518079120721 81.00495689736331773184 82.78070280294467548493 81.62646796431679294126 82.37672060942491659291 81.88905639010463621830 82.20603813266281845867 82.00000000000000000000
result:
ok 10 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.36 0.68 8 72 59
output:
72.00000000000000000000 38.23991864260569822909 62.72637071133805135997 48.58463813305357328898 60.14440181160916130965 54.68953858265572790659 60.58642712165029173971 59.00000000000000000347
result:
ok 8 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3964kb
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: 3724kb
input:
0.46 0.96 6 65 35
output:
65.00000000000000000000 -16.61742366281804768671 54.75598511510369806321 9.23502643664237533091 56.81385787135504279038 35.00000000000000000000
result:
ok 6 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
0.50 0.90 4 19 1
output:
19.00000000000000000000 -6.56521739130434782601 13.81739130434782608734 1.00000000000000000043
result:
ok 4 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
0.54 0.35 3 16 22
output:
16.00000000000000000000 30.37037037037037037063 22.00000000000000000173
result:
ok 3 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
0.55 0.89 10 74 13
output:
74.00000000000000000000 -48.32193707657651907811 39.28293460788291450655 -21.40090996381749900018 23.19131132091616945973 -6.29158864129368090769 17.17989332290386631993 3.84942743684575046847 17.40729014764960378217 12.99999999999999999653
result:
ok 10 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
0.56 0.36 3 31 88
output:
31.00000000000000000000 137.21428571428571427382 88.00000000000000000000
result:
ok 3 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
0.57 0.93 7 71 48
output:
71.00000000000000000000 -34.08056536168601808462 46.60407774383896969267 -5.13060147237978409450 40.41734946251376488224 18.26642982431964677345 48.00000000000000000000
result:
ok 7 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
0.58 0.41 8 30 69
output:
30.00000000000000000000 89.43212168280981214097 64.17063057602969104037 73.88613562404924377941 69.16391719812073471396 70.40838758077021607845 69.19407084807622655698 68.99999999999999999306
result:
ok 8 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.58 0.49 6 31 96
output:
31.00000000000000000000 99.55761353841717245516 72.93341585228196002205 91.08461182814795131790 88.56644862794397217443 96.00000000000000000694
result:
ok 6 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.61 0.29 8 62 25
output:
62.00000000000000000000 34.40765125713371531957 38.96866726685156634424 33.74910589734823291447 31.88786810476937631786 29.23884025414030709937 27.08317430540870646323 25.00000000000000000173
result:
ok 8 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
0.63 0.89 9 37 85
output:
37.00000000000000000000 -5.88785330217688351265 29.22065241962856338778 13.16882158542856860912 34.30273825228941964038 33.33097630997376043666 51.52795211982105255677 62.12717875136390989488 85.00000000000000000694
result:
ok 9 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3900kb
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: 3964kb
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.70357627911755428463 47.19267541857358971152 -24.85797962913296554367 26.31572111777980313603 -5.26696293966279695080 20.26062309522100480380 8.42913836619713586693 23.71350072372704263605 22.99999999999999999306
result:
ok 10 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.67 0.88 4 70 42
output:
70.00000000000000000000 0.54782150650914290097 61.96704040936112574400 42.00000000000000000347
result:
ok 4 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
0.69 0.39 10 2 27
output:
2.00000000000000000000 22.36590768701612573846 16.21247630404112675950 19.90931264772466650209 20.06029148550605932175 21.60623305761180086744 22.73181448909950573382 24.11138288994726129426 25.50226184481241752805 26.99999999999999999827
result:
ok 10 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.69 0.57 4 88 47
output:
88.00000000000000000000 11.84360959755281521993 58.33209062231144250224 47.00000000000000000000
result:
ok 4 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
0.71 0.89 8 4 41
output:
4.00000000000000000000 6.83889036269107182617 8.41561215751066099642 12.06169705462762323234 16.05369972897010078135 22.13303718618735623121 30.00224916097641261921 41.00000000000000000694
result:
ok 8 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3972kb
input:
0.72 0.49 8 21 48
output:
21.00000000000000000000 19.94044236994030131968 24.64711850635701695031 27.51674208584779985146 31.88914236992535419790 36.44338612841167695036 41.86491777371983096304 48.00000000000000000000
result:
ok 8 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
0.74 0.58 3 57 29
output:
57.00000000000000000000 -5.48648648648648648227 29.00000000000000000000
result:
ok 3 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3960kb
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: 3948kb
input:
0.77 0.36 10 31 25
output:
31.00000000000000000000 5.21497208502642237062 15.17552850547034522591 13.56254689982167787720 15.90635137483201624713 17.13040744255645654592 18.91670022570799738863 20.73280585311548234601 22.77427258815380046661 25.00000000000000000347
result:
ok 10 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
0.77 0.96 8 78 68
output:
78.00000000000000000000 -40.09755700760497929697 44.00488110414416594030 -4.60989627710977235148 38.69506572660387459101 25.36970018345960197620 56.68193223880361313050 68.00000000000000000694
result:
ok 8 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.78 0.52 7 73 77
output:
73.00000000000000000000 8.72754750605293229751 44.76748705472128719157 39.45696460583012880191 54.05552566100256980247 62.68093161061367141890 77.00000000000000000000
result:
ok 7 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.78 0.69 4 42 97
output:
42.00000000000000000000 57.29790511398644486246 73.67236598890942698981 97.00000000000000000000
result:
ok 4 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
0.78 0.70 10 54 99
output:
54.00000000000000000000 -13.01288635089969597351 27.64994864629823714125 12.45793949848283778750 29.07215686122537947299 31.39684000069378243952 44.84004500339891593347 56.95302310313680213549 75.81138952282594681287 99.00000000000000000694
result:
ok 10 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.78 0.76 10 97 83
output:
97.00000000000000000000 -43.73473695904048760136 39.60690517194841967288 -2.34501405475100323239 28.27213696797501643089 20.27005615340975035882 37.29746789532061776798 44.49726763494149213082 63.05394435569803336661 83.00000000000000004163
result:
ok 10 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
0.78 0.95 10 100 32
output:
100.00000000000000000000 -63.26957881736412780960 45.64972852245598031184 -24.49931162898025677546 24.25777902572858101167 -4.35327840746295074807 19.64933291662105037736 11.19086518787461608307 27.39574111733219840235 32.00000000000000003123
result:
ok 10 numbers
Test #41:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
0.79 0.90 10 98 42
output:
98.00000000000000000000 -58.24691462804136208448 42.18493744384732395056 -19.09612258459783995512 22.88050685763029799130 0.88909009138987945414 21.29483734406527296011 17.62310258406245714810 33.08760465106808681263 42.00000000000000001388
result:
ok 10 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
0.81 0.48 10 97 1
output:
97.00000000000000000000 -38.25750168159921594385 15.57142363790463508375 -5.75074766046486923494 2.81617774121768075970 -0.47925490663681581736 0.96356884140866595263 0.55044840635534782929 0.90837625302399139897 0.99999999999999999122
result:
ok 10 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.81 0.86 10 20 100
output:
20.00000000000000000000 -3.33284286965140158498 14.50039727558236471710 8.87907692532151005763 19.66239396651125680322 23.56254526865061666059 35.99532047880668034559 49.41999851887294140790 70.98617441206082763483 100.00000000000000000000
result:
ok 10 numbers
Test #44:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
0.84 0.85 10 74 95
output:
74.00000000000000000000 -36.29080487709828994197 32.41572390323743645124 -3.61797606681409983365 24.51426542162797712378 17.51670329737551592454 35.55115637817921393077 44.75216916043972823630 67.81030501622170356124 94.99999999999999998612
result:
ok 10 numbers
Test #45:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
0.88 0.37 10 3 96
output:
3.00000000000000000000 29.02182849037642299247 26.64920907153125223359 34.18938052438677847183 39.94686221792692838034 47.80330954579880500810 56.84725142093591190862 67.71280578236916033313 80.62075211423114849685 96.00000000000000000000
result:
ok 10 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.91 0.50 10 100 98
output:
100.00000000000000000000 -22.58685785448442357934 29.44595935241917454214 15.50239408345923704420 28.83015829215749298124 33.98664108759293713685 45.34292253578831928540 58.25538005136383911883 75.68385711463525324094 98.00000000000000001388
result:
ok 10 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
0.94 0.48 10 44 97
output:
44.00000000000000000000 -1.58274343871780689887 19.63222116760526151334 17.69457104696439851167 26.05636294459706012693 32.98637527046414780543 43.51424696764288779782 56.73685227940710547670 74.21947968711126528835 97.00000000000000000000
result:
ok 10 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
0.94 0.54 10 28 95
output:
28.00000000000000000000 0.45254630714584047878 15.54539352871709005123 14.85704492285281850660 22.36013473298887802368 29.04133090735006733629 39.37332380872305742994 52.69324307016871034720 70.79324334266903873819 95.00000000000000000000
result:
ok 10 numbers
Test #49:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
0.95 0.57 10 2 94
output:
2.00000000000000000000 9.22728417416105979251 9.90591996545300680285 14.67017594645216054493 19.58304152943776639539 26.96588974244360958563 36.77992892710095595293 50.31148963393876561920 68.76047464068937223325 94.00000000000000002082
result:
ok 10 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
0.98 0.90 10 21 99
output:
21.00000000000000000000 -8.21319348497017535232 10.85107038472922815452 3.24217484056148577470 12.94329469000656139804 15.60238615271176736751 26.93930365066343727773 40.44266511509075916198 63.87918509838603752654 99.00000000000000002082
result:
ok 10 numbers
Extra Test:
score: 0
Extra Test Passed