QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#433697 | #8795. Mysterious Sequence | ucup-team055# | AC ✓ | 0ms | 4048kb | C++23 | 640b | 2024-06-08 13:15:19 | 2024-06-08 13:15:20 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, a, b) for(ll i = a; i < (b); i++)
int main() {
ld A, B;
ll N;
ld X0, Xl;
cin >> A >> B >> N >> X0 >> Xl;
vector<ld> C(N), D(N);
C[0] = D[0] = X0;
D[1] = 1;
rep(i, 2, N) {
C[i] = C[i - 1] * A + C[i - 2] * B;
D[i] = D[i - 1] * A + D[i - 2] * B;
}
// Xl == C.back() * (1 - p) + D.back() * p;
ld p = (Xl - C.back()) / (D.back() - C.back());
cout.precision(12);
rep(i, 0, N) {
cout << lerp(C[i], D[i], p) << '\n';
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4032kb
input:
1.0 1.0 10 1 10
output:
1 -0.323529411765 0.676470588235 0.352941176471 1.02941176471 1.38235294118 2.41176470588 3.79411764706 6.20588235294 10
result:
ok 10 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
1 1 2 1 100
output:
1 100
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
1 1 5 50 100
output:
50 0 50 50 100
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.25 0.25 10 1 1
output:
1 55.8755364807 14.2188841202 17.5236051502 7.9356223176 6.36480686695 3.57510729614 2.48497854077 1.51502145923 1
result:
ok 10 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
0.25 0.63 6 93 12
output:
93 -14.2048079587 55.0387980103 4.81067048862 35.8771103687 12
result:
ok 6 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 4040kb
input:
0.25 0.80 10 5 63
output:
5 78.7695361835 23.6923840459 68.9387249583 36.1885884763 64.1981270857 45.0004025525 62.6086023067 51.6524726186 63
result:
ok 10 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
0.25 0.99 3 18 30
output:
18 48.72 30
result:
ok 3 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
0.28 0.64 9 6 10
output:
6 20.9504033485 9.70611293758 16.1259697656 10.7271838144 13.324232118 10.5961826343 11.4944396931 10
result:
ok 9 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.31 0.40 7 10 49
output:
10 240.115063999 78.4356698396 120.36108325 68.6862037433 69.4371564603 49
result:
ok 7 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
0.32 0.28 5 36 6
output:
36 10.1213768116 13.3188405797 7.09601449275 6
result:
ok 5 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 4036kb
input:
0.35 0.65 10 86 82
output:
86 79.5339247862 83.7368736752 81.0049568974 82.7807028029 81.6264679643 82.3767206094 81.8890563901 82.2060381327 82
result:
ok 10 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.36 0.68 8 72 59
output:
72 38.2399186426 62.7263707113 48.5846381331 60.1444018116 54.6895385827 60.5864271217 59
result:
ok 8 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
0.43 0.61 2 93 84
output:
93 84
result:
ok 2 numbers
Test #14:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
0.46 0.96 6 65 35
output:
65 -16.6174236628 54.7559851151 9.23502643664 56.8138578714 35
result:
ok 6 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
0.50 0.90 4 19 1
output:
19 -6.5652173913 13.8173913043 1
result:
ok 4 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
0.54 0.35 3 16 22
output:
16 30.3703703704 22
result:
ok 3 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.55 0.89 10 74 13
output:
74 -48.3219370766 39.2829346079 -21.4009099638 23.1913113209 -6.29158864129 17.1798933229 3.84942743685 17.4072901476 13
result:
ok 10 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 4032kb
input:
0.56 0.36 3 31 88
output:
31 137.214285714 88
result:
ok 3 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
0.57 0.93 7 71 48
output:
71 -34.0805653617 46.6040777438 -5.13060147238 40.4173494625 18.2664298243 48
result:
ok 7 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3972kb
input:
0.58 0.41 8 30 69
output:
30 89.4321216828 64.170630576 73.886135624 69.1639171981 70.4083875808 69.1940708481 69
result:
ok 8 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.58 0.49 6 31 96
output:
31 99.5576135384 72.9334158523 91.0846118281 88.5664486279 96
result:
ok 6 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
0.61 0.29 8 62 25
output:
62 34.4076512571 38.9686672669 33.7491058973 31.8878681048 29.2388402541 27.0831743054 25
result:
ok 8 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.63 0.89 9 37 85
output:
37 -5.88785330218 29.2206524196 13.1688215854 34.3027382523 33.33097631 51.5279521198 62.1271787514 85
result:
ok 9 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
0.64 0.67 2 74 42
output:
74 42
result:
ok 2 numbers
Test #25:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
0.65 0.56 2 94 96
output:
94 96
result:
ok 2 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
0.65 0.90 10 97 23
output:
97 -61.7035762791 47.1926754186 -24.8579796291 26.3157211178 -5.26696293966 20.2606230952 8.4291383662 23.7135007237 23
result:
ok 10 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
0.67 0.88 4 70 42
output:
70 0.547821506509 61.9670404094 42
result:
ok 4 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 4040kb
input:
0.69 0.39 10 2 27
output:
2 22.365907687 16.212476304 19.9093126477 20.0602914855 21.6062330576 22.7318144891 24.1113828899 25.5022618448 27
result:
ok 10 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
0.69 0.57 4 88 47
output:
88 11.8436095976 58.3320906223 47
result:
ok 4 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 4048kb
input:
0.71 0.89 8 4 41
output:
4 6.83889036269 8.41561215751 12.0616970546 16.053699729 22.1330371862 30.002249161 41
result:
ok 8 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 4048kb
input:
0.72 0.49 8 21 48
output:
21 19.9404423699 24.6471185064 27.5167420858 31.8891423699 36.4433861284 41.8649177737 48
result:
ok 8 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 4048kb
input:
0.74 0.58 3 57 29
output:
57 -5.48648648649 29
result:
ok 3 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
0.76 0.70 2 91 18
output:
91 18
result:
ok 2 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.77 0.36 10 31 25
output:
31 5.21497208503 15.1755285055 13.5625468998 15.9063513748 17.1304074426 18.9167002257 20.7328058531 22.7742725882 25
result:
ok 10 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 4044kb
input:
0.77 0.96 8 78 68
output:
78 -40.0975570076 44.0048811041 -4.60989627711 38.6950657266 25.3697001835 56.6819322388 68
result:
ok 8 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
0.78 0.52 7 73 77
output:
73 8.72754750605 44.7674870547 39.4569646058 54.055525661 62.6809316106 77
result:
ok 7 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
0.78 0.69 4 42 97
output:
42 57.297905114 73.6723659889 97
result:
ok 4 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
0.78 0.70 10 54 99
output:
54 -13.0128863509 27.6499486463 12.4579394985 29.0721568612 31.3968400007 44.8400450034 56.9530231031 75.8113895228 99
result:
ok 10 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 4032kb
input:
0.78 0.76 10 97 83
output:
97 -43.734736959 39.6069051719 -2.34501405475 28.272136968 20.2700561534 37.2974678953 44.4972676349 63.0539443557 83
result:
ok 10 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
0.78 0.95 10 100 32
output:
100 -63.2695788174 45.6497285225 -24.499311629 24.2577790257 -4.35327840746 19.6493329166 11.1908651879 27.3957411173 32
result:
ok 10 numbers
Test #41:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
0.79 0.90 10 98 42
output:
98 -58.246914628 42.1849374438 -19.0961225846 22.8805068576 0.88909009139 21.2948373441 17.6231025841 33.0876046511 42
result:
ok 10 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.81 0.48 10 97 1
output:
97 -38.2575016816 15.5714236379 -5.75074766046 2.81617774122 -0.479254906637 0.963568841409 0.550448406355 0.908376253024 1
result:
ok 10 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
0.81 0.86 10 20 100
output:
20 -3.33284286965 14.5003972756 8.87907692532 19.6623939665 23.5625452687 35.9953204788 49.4199985189 70.9861744121 100
result:
ok 10 numbers
Test #44:
score: 0
Accepted
time: 0ms
memory: 4032kb
input:
0.84 0.85 10 74 95
output:
74 -36.2908048771 32.4157239032 -3.61797606681 24.5142654216 17.5167032974 35.5511563782 44.7521691604 67.8103050162 95
result:
ok 10 numbers
Test #45:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.88 0.37 10 3 96
output:
3 29.0218284904 26.6492090715 34.1893805244 39.9468622179 47.8033095458 56.8472514209 67.7128057824 80.6207521142 96
result:
ok 10 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 4028kb
input:
0.91 0.50 10 100 98
output:
100 -22.5868578545 29.4459593524 15.5023940835 28.8301582922 33.9866410876 45.3429225358 58.2553800514 75.6838571146 98
result:
ok 10 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 4048kb
input:
0.94 0.48 10 44 97
output:
44 -1.58274343872 19.6322211676 17.694571047 26.0563629446 32.9863752705 43.5142469676 56.7368522794 74.2194796871 97
result:
ok 10 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.94 0.54 10 28 95
output:
28 0.452546307146 15.5453935287 14.8570449229 22.360134733 29.0413309074 39.3733238087 52.6932430702 70.7932433427 95
result:
ok 10 numbers
Test #49:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
0.95 0.57 10 2 94
output:
2 9.22728417416 9.90591996545 14.6701759465 19.5830415294 26.9658897424 36.7799289271 50.3114896339 68.7604746407 94
result:
ok 10 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
0.98 0.90 10 21 99
output:
21 -8.21319348497 10.8510703847 3.24217484056 12.94329469 15.6023861527 26.9393036507 40.4426651151 63.8791850984 99
result:
ok 10 numbers
Extra Test:
score: 0
Extra Test Passed