QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#434475 | #8795. Mysterious Sequence | ucup-team228# | AC ✓ | 1ms | 4092kb | C++20 | 1.9kb | 2024-06-08 16:18:26 | 2024-06-08 16:18:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string to_string(string a) { return '"' + a + '"'; }
string to_string(char a) { return "'" + string(1, a) + "'"; }
string to_string(const char* a) { return to_string((string) a); }
string to_string(bool a) { return a ? "true" : "false"; }
template <class T1, class T2>
string to_string(pair<T1, T2> a) {
return "(" + to_string(a.first) + ", " + to_string(a.second) + ")";
}
template <class T>
string to_string(T a) {
bool first = true; string res = "{";
for (const auto& i : a) {
if (!first) res += ", ";
first = false;
res += to_string(i);
}
res += "}";
return res;
}
void debug_out() { cerr << endl; }
template <class T1, class... T2>
void debug_out(T1 a, T2... b) {
cerr << " " << to_string(a);
debug_out(b...);
}
#ifdef LOCAL
#define out(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define out(...) 42
#endif
clock_t start_time; void start_timer() { start_time = clock(); }
double get_time() { return (double) (clock() - start_time) / CLOCKS_PER_SEC; }
void Solve();
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
freopen("../input.txt", "r", stdin);
#endif
start_timer();
Solve();
#ifdef LOCAL
cerr << fixed << setprecision(3);
cerr << endl << "Time spent: " << get_time() << endl;
#endif
return 0;
}
typedef pair<double, double> pdd;
void Solve() {
int n;
double A, B, x1, xn;
cin >> A >> B >> n >> x1 >> xn;
vector<double> a(n), b(n);
a[0] = 0; b[0] = x1;
a[1] = 1; b[1] = 0;
for (int i = 2; i < n; ++i) {
a[i] = A * a[i - 1] + B * a[i - 2];
b[i] = A * b[i - 1] + B * b[i - 2];
}
double x = (xn - b[n - 1]) / a[n - 1];
cout << fixed << setprecision(15);
for (int i = 0; i < n; ++i) {
cout << a[i] * x + b[i] << '\n';
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3928kb
input:
1.0 1.0 10 1 10
output:
1.000000000000000 -0.323529411764706 0.676470588235294 0.352941176470588 1.029411764705882 1.382352941176471 2.411764705882353 3.794117647058823 6.205882352941176 10.000000000000000
result:
ok 10 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 4008kb
input:
1 1 2 1 100
output:
1.000000000000000 100.000000000000000
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 1ms
memory: 3924kb
input:
1 1 5 50 100
output:
50.000000000000000 0.000000000000000 50.000000000000000 50.000000000000000 100.000000000000000
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 1ms
memory: 4092kb
input:
0.25 0.25 10 1 1
output:
1.000000000000000 55.875536480686698 14.218884120171674 17.523605150214593 7.935622317596567 6.364806866952790 3.575107296137339 2.484978540772532 1.515021459227468 1.000000000000000
result:
ok 10 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
0.25 0.63 6 93 12
output:
93.000000000000000 -14.204807958665043 55.038798010333743 4.810670488624458 35.877110368666379 12.000000000000000
result:
ok 6 numbers
Test #6:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
0.25 0.80 10 5 63
output:
5.000000000000000 78.769536183531358 23.692384045882839 68.938724958295793 36.188588476280223 64.198127085706687 45.000402552450851 62.608602306678065 51.652472618630206 63.000000000000000
result:
ok 10 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.25 0.99 3 18 30
output:
18.000000000000000 48.719999999999999 30.000000000000000
result:
ok 3 numbers
Test #8:
score: 0
Accepted
time: 1ms
memory: 4084kb
input:
0.28 0.64 9 6 10
output:
6.000000000000000 20.950403348507802 9.706112937582185 16.125969765568005 10.727183814411640 13.324232117998784 10.596182634263108 11.494439693112893 10.000000000000000
result:
ok 9 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
0.31 0.40 7 10 49
output:
10.000000000000000 240.115063998688214 78.435669839593345 120.361083249749228 68.686203743259597 69.437156460310177 49.000000000000000
result:
ok 7 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
0.32 0.28 5 36 6
output:
36.000000000000000 10.121376811594196 13.318840579710145 7.096014492753621 6.000000000000000
result:
ok 5 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.35 0.65 10 86 82
output:
86.000000000000000 79.533924786230855 83.736873675180789 81.004956897363328 82.780702802944688 81.626467964316802 82.376720609424922 81.889056390104656 82.206038132662826 82.000000000000000
result:
ok 10 numbers
Test #12:
score: 0
Accepted
time: 1ms
memory: 4092kb
input:
0.36 0.68 8 72 59
output:
72.000000000000000 38.239918642605687 62.726370711338049 48.584638133053566 60.144401811609157 54.689538582655729 60.586427121650289 59.000000000000000
result:
ok 8 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.43 0.61 2 93 84
output:
93.000000000000000 84.000000000000000
result:
ok 2 numbers
Test #14:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
0.46 0.96 6 65 35
output:
65.000000000000000 -16.617423662818052 54.755985115103698 9.235026436642372 56.813857871355040 35.000000000000000
result:
ok 6 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.50 0.90 4 19 1
output:
19.000000000000000 -6.565217391304349 13.817391304347828 1.000000000000001
result:
ok 4 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.54 0.35 3 16 22
output:
16.000000000000000 30.370370370370367 22.000000000000000
result:
ok 3 numbers
Test #17:
score: 0
Accepted
time: 1ms
memory: 3940kb
input:
0.55 0.89 10 74 13
output:
74.000000000000000 -48.321937076576518 39.282934607882908 -21.400909963817497 23.191311320916171 -6.291588641293671 17.179893322903879 3.849427436845758 17.407290147649633 13.000000000000000
result:
ok 10 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.56 0.36 3 31 88
output:
31.000000000000000 137.214285714285694 87.999999999999986
result:
ok 3 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 4036kb
input:
0.57 0.93 7 71 48
output:
71.000000000000000 -34.080565361686013 46.604077743838971 -5.130601472379787 40.417349462513769 18.266429824319637 48.000000000000000
result:
ok 7 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.58 0.41 8 30 69
output:
30.000000000000000 89.432121682809822 64.170630576029694 73.886135624049246 69.163917198120743 70.408387580770210 69.194070848076223 69.000000000000000
result:
ok 8 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
0.58 0.49 6 31 96
output:
31.000000000000000 99.557613538417186 72.933415852281968 91.084611828147956 88.566448627943984 96.000000000000000
result:
ok 6 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.61 0.29 8 62 25
output:
62.000000000000000 34.407651257133729 38.968667266851575 33.749105897348244 31.887868104769382 29.238840254140310 27.083174305408708 25.000000000000000
result:
ok 8 numbers
Test #23:
score: 0
Accepted
time: 1ms
memory: 4012kb
input:
0.63 0.89 9 37 85
output:
37.000000000000000 -5.887853302176888 29.220652419628561 13.168821585428560 34.302738252289416 33.330976309973749 51.527952119821052 62.127178751363900 85.000000000000000
result:
ok 9 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
0.64 0.67 2 74 42
output:
74.000000000000000 42.000000000000000
result:
ok 2 numbers
Test #25:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
0.65 0.56 2 94 96
output:
94.000000000000000 96.000000000000000
result:
ok 2 numbers
Test #26:
score: 0
Accepted
time: 1ms
memory: 4004kb
input:
0.65 0.90 10 97 23
output:
97.000000000000000 -61.703576279117563 47.192675418573579 -24.857979629132977 26.315721117779773 -5.266962939662804 20.260623095220978 8.429138366197122 23.713500723727066 23.000000000000000
result:
ok 10 numbers
Test #27:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
0.67 0.88 4 70 42
output:
70.000000000000000 0.547821506509139 61.967040409361125 42.000000000000000
result:
ok 4 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
0.69 0.39 10 2 27
output:
2.000000000000000 22.365907687016133 16.212476304041132 19.909312647724668 20.060291485506060 21.606233057611803 22.731814489099509 24.111382889947265 25.502261844812420 27.000000000000000
result:
ok 10 numbers
Test #29:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
0.69 0.57 4 88 47
output:
88.000000000000000 11.843609597552819 58.332090622311441 47.000000000000000
result:
ok 4 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
0.71 0.89 8 4 41
output:
4.000000000000000 6.838890362691074 8.415612157510662 12.061697054627626 16.053699728970102 22.133037186187359 30.002249160976415 41.000000000000000
result:
ok 8 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
0.72 0.49 8 21 48
output:
21.000000000000000 19.940442369940310 24.647118506357025 27.516742085847806 31.889142369925359 36.443386128411682 41.864917773719839 48.000000000000000
result:
ok 8 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
0.74 0.58 3 57 29
output:
57.000000000000000 -5.486486486486480 29.000000000000000
result:
ok 3 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
0.76 0.70 2 91 18
output:
91.000000000000000 18.000000000000000
result:
ok 2 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.77 0.36 10 31 25
output:
31.000000000000000 5.214972085026420 15.175528505470343 13.562546899821676 15.906351374832013 17.130407442556454 18.916700225707995 20.732805853115480 22.774272588153799 25.000000000000000
result:
ok 10 numbers
Test #35:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
0.77 0.96 8 78 68
output:
78.000000000000000 -40.097557007604983 44.004881104144161 -4.609896277109783 38.695065726603858 25.369700183459571 56.681932238803597 67.999999999999972
result:
ok 8 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.78 0.52 7 73 77
output:
73.000000000000000 8.727547506052934 44.767487054721286 39.456964605830137 54.055525661002569 62.680931610613676 77.000000000000000
result:
ok 7 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.78 0.69 4 42 97
output:
42.000000000000000 57.297905113986445 73.672365988909434 97.000000000000000
result:
ok 4 numbers
Test #38:
score: 0
Accepted
time: 1ms
memory: 3940kb
input:
0.78 0.70 10 54 99
output:
54.000000000000000 -13.012886350899690 27.649948646298238 12.457939498482844 29.072156861225384 31.396840000693789 44.840045003398913 56.953023103136807 75.811389522825948 99.000000000000000
result:
ok 10 numbers
Test #39:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
0.78 0.76 10 97 83
output:
97.000000000000000 -43.734736959040490 39.606905171948419 -2.345014054751005 28.272136967975015 20.270056153409740 37.297467895320636 44.497267634941494 63.053944355698036 83.000000000000000
result:
ok 10 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 4008kb
input:
0.78 0.95 10 100 32
output:
100.000000000000000 -63.269578817364128 45.649728522455980 -24.499311628980251 24.257779025728595 -4.353278407462966 19.649332916621063 11.190865187874692 27.395741117332250 32.000000000000000
result:
ok 10 numbers
Test #41:
score: 0
Accepted
time: 0ms
memory: 3996kb
input:
0.79 0.90 10 98 42
output:
98.000000000000000 -58.246914628041367 42.184937443847318 -19.096122584597850 22.880506857630309 0.889090091389875 21.294837344065257 17.623102584062451 33.087604651068091 42.000000000000000
result:
ok 10 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
0.81 0.48 10 97 1
output:
97.000000000000000 -38.257501681599223 15.571423637904623 -5.750747660464882 2.816177741217672 -0.479254906636832 0.963568841408645 0.550448406355329 0.908376253023974 1.000000000000000
result:
ok 10 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3996kb
input:
0.81 0.86 10 20 100
output:
20.000000000000000 -3.332842869651402 14.500397275582364 8.879076925321510 19.662393966511257 23.562545268650616 35.995320478806676 49.419998518872944 70.986174412060834 100.000000000000000
result:
ok 10 numbers
Test #44:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
0.84 0.85 10 74 95
output:
74.000000000000000 -36.290804877098296 32.415723903237435 -3.617976066814109 24.514265421627968 17.516703297375514 35.551156378179201 44.752169160439706 67.810305016221605 95.000000000000000
result:
ok 10 numbers
Test #45:
score: 0
Accepted
time: 0ms
memory: 4088kb
input:
0.88 0.37 10 3 96
output:
3.000000000000000 29.021828490376418 26.649209071531246 34.189380524386770 39.946862217926920 47.803309545798811 56.847251420935919 67.712805782369159 80.620752114231152 96.000000000000000
result:
ok 10 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
0.91 0.50 10 100 98
output:
100.000000000000000 -22.586857854484428 29.445959352419170 15.502394083459230 28.830158292157485 33.986641087592929 45.342922535788304 58.255380051363815 75.683857114635245 98.000000000000000
result:
ok 10 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
0.94 0.48 10 44 97
output:
44.000000000000000 -1.582743438717798 19.632221167605266 17.694571046964406 26.056362944597069 32.986375270464158 43.514246967642904 56.736852279407117 74.219479687111274 97.000000000000000
result:
ok 10 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 3992kb
input:
0.94 0.54 10 28 95
output:
28.000000000000000 0.452546307145843 15.545393528717094 14.857044922852822 22.360134732988882 29.041330907350073 39.373323808723065 52.693243070168712 70.793243342669044 95.000000000000000
result:
ok 10 numbers
Test #49:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
0.95 0.57 10 2 94
output:
2.000000000000000 9.227284174161063 9.905919965453011 14.670175946452165 19.583041529437775 26.965889742443615 36.779928927100961 50.311489633938777 68.760474640689367 94.000000000000000
result:
ok 10 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
0.98 0.90 10 21 99
output:
21.000000000000000 -8.213193484970178 10.851070384729228 3.242174840561484 12.943294690006557 15.602386152711766 26.939303650663433 40.442665115090747 63.879185098386017 99.000000000000000
result:
ok 10 numbers
Extra Test:
score: 0
Extra Test Passed