QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#779494 | #8795. Mysterious Sequence | woodie_0064# | AC ✓ | 1ms | 3944kb | C++20 | 974b | 2024-11-24 19:24:40 | 2024-11-24 19:24:42 |
Judging History
answer
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
using ld = long double;
const int N = 1e5 + 3;
int T;
int n, num;
void work(){
ld a, b, x1, xn;
cin >> a >> b >> n >> x1 >> xn;
if(n == 2){
cout << x1 << "\n" << xn;
return;
}
ld l = -2e9, r = 2e9, ans, x11, x2, x22, xi;
while(l + 1e-8< r){
x2 = (l + r) / 2;
x11 = x1, x22 = x2;
for(int i = 3; i <= n; ++i){
xi = b * x11 + a * x22;
x11 = x22, x22 = xi;
}
if(abs(xi - xn) < 1e-8){
break;
}else if(xi > xn) r = x2;
else l = x2;
}
cout << x1 << "\n" << x2 << "\n";
x11 = x1, x22 = x2;
for(int i = 3; i < n; ++i){
xi = b * x11 + a * x22;
x11 = x22, x22 = xi;
cout << xi << "\n";
}
cout << xn;
}
int main(){
// freopen("test.txt", "r", stdin);
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed << setprecision(10);
int T = 1;
while(T--){
work();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3816kb
input:
1.0 1.0 10 1 10
output:
1.0000000000 -0.3235294116 0.6764705884 0.3529411768 1.0294117652 1.3823529420 2.4117647072 3.7941176493 6.2058823565 10.0000000000
result:
ok 10 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
1 1 2 1 100
output:
1.0000000000 100.0000000000
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
1 1 5 50 100
output:
50.0000000000 0.0000000000 50.0000000000 50.0000000000 100.0000000000
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
0.25 0.25 10 1 1
output:
1.0000000000 55.8755361979 14.2188840495 17.5236050618 7.9356222778 6.3648068349 3.5751072782 2.4849785283 1.5150214516 1.0000000000
result:
ok 10 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
0.25 0.63 6 93 12
output:
93.0000000000 -14.2048079410 55.0387980147 4.8106705009 35.8771103745 12.0000000000
result:
ok 6 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
0.25 0.80 10 5 63
output:
5.0000000000 78.7695361715 23.6923840429 68.9387249479 36.1885884713 64.1981270761 45.0004025460 62.6086022974 51.6524726112 63.0000000000
result:
ok 10 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.25 0.99 3 18 30
output:
18.0000000000 48.7200000343 30.0000000000
result:
ok 3 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
0.28 0.64 9 6 10
output:
6.0000000000 20.9504033566 9.7061129398 16.1259697714 10.7271838175 13.3242321226 10.5961826375 11.4944396970 10.0000000000
result:
ok 9 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
0.31 0.40 7 10 49
output:
10.0000000000 240.1150639986 78.4356698396 120.3610832497 68.6862037432 69.4371564603 49.0000000000
result:
ok 7 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.32 0.28 5 36 6
output:
36.0000000000 10.1213768477 13.3188405913 7.0960145066 6.0000000000
result:
ok 5 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.35 0.65 10 86 82
output:
86.0000000000 79.5339247794 83.7368736728 81.0049568921 82.7807027996 81.6264679597 82.3767206056 81.8890563858 82.2060381287 82.0000000000
result:
ok 10 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
0.36 0.68 8 72 59
output:
72.0000000000 38.2399186483 62.7263707134 48.5846381376 60.1444018146 54.6895385869 60.5864271252 59.0000000000
result:
ok 8 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
0.43 0.61 2 93 84
output:
93.0000000000 84.0000000000
result:
ok 2 numbers
Test #14:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
0.46 0.96 6 65 35
output:
65.0000000000 -16.6174236593 54.7559851167 9.2350264407 56.8138578748 35.0000000000
result:
ok 6 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
0.50 0.90 4 19 1
output:
19.0000000000 -6.5652173975 13.8173913012 1.0000000000
result:
ok 4 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
0.54 0.35 3 16 22
output:
16.0000000000 30.3703703852 22.0000000000
result:
ok 3 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
0.55 0.89 10 74 13
output:
74.0000000000 -48.3219370767 39.2829346078 -21.4009099640 23.1913113208 -6.2915886415 17.1798933226 3.8494274365 17.4072901472 13.0000000000
result:
ok 10 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
0.56 0.36 3 31 88
output:
31.0000000000 137.2142857115 88.0000000000
result:
ok 3 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
0.57 0.93 7 71 48
output:
71.0000000000 -34.0805653629 46.6040777432 -5.1306014739 40.4173494611 18.2664298221 48.0000000000
result:
ok 7 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
0.58 0.41 8 30 69
output:
30.0000000000 89.4321216804 64.1706305747 73.8861356223 69.1639171965 70.4083875791 69.1940708465 69.0000000000
result:
ok 8 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
0.58 0.49 6 31 96
output:
31.0000000000 99.5576135421 72.9334158544 91.0846118312 88.5664486307 96.0000000000
result:
ok 6 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
0.61 0.29 8 62 25
output:
62.0000000000 34.4076512560 38.9686672661 33.7491058966 31.8878681041 29.2388402535 27.0831743048 25.0000000000
result:
ok 8 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
0.63 0.89 9 37 85
output:
37.0000000000 -5.8878533021 29.2206524197 13.1688215855 34.3027382523 33.3309763101 51.5279521199 62.1271787515 85.0000000000
result:
ok 9 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
0.64 0.67 2 74 42
output:
74.0000000000 42.0000000000
result:
ok 2 numbers
Test #25:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
0.65 0.56 2 94 96
output:
94.0000000000 96.0000000000
result:
ok 2 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
0.65 0.90 10 97 23
output:
97.0000000000 -61.7035762832 47.1926754159 -24.8579796345 26.3157211119 -5.2669629483 20.2606230844 8.4291383514 23.7135007044 23.0000000000
result:
ok 10 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
0.67 0.88 4 70 42
output:
70.0000000000 0.5478215104 61.9670404120 42.0000000000
result:
ok 4 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
0.69 0.39 10 2 27
output:
2.0000000000 22.3659076815 16.2124763002 19.9093126429 20.0602914807 21.6062330524 22.7318144836 24.1113828841 25.5022618387 27.0000000000
result:
ok 10 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
0.69 0.57 4 88 47
output:
88.0000000000 11.8436095931 58.3320906192 47.0000000000
result:
ok 4 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
0.71 0.89 8 4 41
output:
4.0000000000 6.8388903637 8.4156121583 12.0616970561 16.0536997307 22.1330371887 30.0022491643 41.0000000000
result:
ok 8 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
0.72 0.49 8 21 48
output:
21.0000000000 19.9404423668 24.6471185041 27.5167420826 31.8891423665 36.4433861244 41.8649177691 48.0000000000
result:
ok 8 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
0.74 0.58 3 57 29
output:
57.0000000000 -5.4864864873 29.0000000000
result:
ok 3 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
0.76 0.70 2 91 18
output:
91.0000000000 18.0000000000
result:
ok 2 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.77 0.36 10 31 25
output:
31.0000000000 5.2149720792 15.1755285010 13.5625468942 15.9063513689 17.1304074360 18.9167002185 20.7328058452 22.7742725795 25.0000000000
result:
ok 10 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
0.77 0.96 8 78 68
output:
78.0000000000 -40.0975570039 44.0048811070 -4.6098962714 38.6950657338 25.3697001945 56.6819322542 68.0000000000
result:
ok 8 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
0.78 0.52 7 73 77
output:
73.0000000000 8.7275475041 44.7674870532 39.4569646037 54.0555256585 62.6809316076 77.0000000000
result:
ok 7 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
0.78 0.69 4 42 97
output:
42.0000000000 57.2979051150 73.6723659897 97.0000000000
result:
ok 4 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
0.78 0.70 10 54 99
output:
54.0000000000 -13.0128863518 27.6499486456 12.4579394973 29.0721568598 31.3968399988 44.8400450009 56.9530230998 75.8113895185 99.0000000000
result:
ok 10 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
0.78 0.76 10 97 83
output:
97.0000000000 -43.7347369639 39.6069051682 -2.3450140614 28.2721369599 20.2700561421 37.2974678804 44.4972676146 63.0539443285 83.0000000000
result:
ok 10 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
0.78 0.95 10 100 32
output:
100.0000000000 -63.2695788191 45.6497285211 -24.4993116317 24.2577790223 -4.3532784128 19.6493329092 11.1908651770 27.3957411018 32.0000000000
result:
ok 10 numbers
Test #41:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.79 0.90 10 98 42
output:
98.0000000000 -58.2469146318 42.1849374409 -19.0961225903 22.8805068504 0.8890900806 21.2948373290 17.6231025624 33.0876046204 42.0000000000
result:
ok 10 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
0.81 0.48 10 97 1
output:
97.0000000000 -38.2575016805 15.5714236388 -5.7507476592 2.8161777426 -0.4792549049 0.9635688435 0.5504484089 0.9083762561 1.0000000000
result:
ok 10 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
0.81 0.86 10 20 100
output:
20.0000000000 -3.3328428697 14.5003972755 8.8790769252 19.6623939663 23.5625452684 35.9953204785 49.4199985184 70.9861744113 100.0000000000
result:
ok 10 numbers
Test #44:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
0.84 0.85 10 74 95
output:
74.0000000000 -36.2908048820 32.4157238991 -3.6179760745 24.5142654116 17.5167032824 35.5511563571 44.7521691301 67.8103049728 95.0000000000
result:
ok 10 numbers
Test #45:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
0.88 0.37 10 3 96
output:
3.0000000000 29.0218284890 26.6492090703 34.1893805228 39.9468622161 47.8033095436 56.8472514184 67.7128057793 80.6207521106 96.0000000000
result:
ok 10 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
0.91 0.50 10 100 98
output:
100.0000000000 -22.5868578493 29.4459593571 15.5023940903 28.8301583007 33.9866410988 45.3429225503 58.2553800701 75.6838571390 98.0000000000
result:
ok 10 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
0.94 0.48 10 44 97
output:
44.0000000000 -1.5827434433 19.6322211633 17.6945710408 26.0563629367 32.9863752601 43.5142469541 56.7368522617 74.2194796640 97.0000000000
result:
ok 10 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
0.94 0.54 10 28 95
output:
28.0000000000 0.4525463060 15.5453935276 14.8570449212 22.3601347308 29.0413309044 39.3733238048 52.6932430649 70.7932433357 95.0000000000
result:
ok 10 numbers
Test #49:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
0.95 0.57 10 2 94
output:
2.0000000000 9.2272841798 9.9059199708 14.6701759547 19.5830415404 26.9658897575 36.7799289477 50.3114896621 68.7604746792 94.0000000000
result:
ok 10 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
0.98 0.90 10 21 99
output:
21.0000000000 -8.2131934795 10.8510703901 3.2421748508 12.9432947048 15.6023861764 26.9393036872 40.4426651723 63.8791851873 99.0000000000
result:
ok 10 numbers
Extra Test:
score: 0
Extra Test Passed