QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#741186 | #8795. Mysterious Sequence | ucup-team5657# | AC ✓ | 0ms | 3980kb | C++20 | 1.8kb | 2024-11-13 13:43:39 | 2024-11-13 13:43:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define _rep(i_,a_,b_) for(int i_ = (a_); i_ <= (b_); ++i_)
#define mid ((L+R) >> 1)
#define multiCase() int testCnt = in(); _rep(curCase,1,testCnt)
#ifdef ONLINE_JUDGE
#define debug(...) 0
#else
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#endif
using ll = long long;
using pii = pair<int,int>;
using ull = unsigned long long;
const int inf = 0x3f3f3f3f;
const ll inf64 = 0x3f3f3f3f3f3f3f3fll;
int in(void) { int x; scanf("%d", &x); return x; } ll inl(void) { ll x; scanf("%lld", &x); return x; }
void out(int x) { printf("%d ", x); } void outln(int x) { printf("%d\n", x); }
void out(unsigned x) { printf("%u ", x); } void outln(unsigned x) { printf("%u\n", x); }
void out(ll x) { printf("%lld ", x); } void outln(ll x) { printf("%lld\n", x); }
void out(ull x) { printf("%llu ", x); } void outln(ull x) { printf("%llu\n", x); }
template<typename T, typename U> void chkmax(T &a, const U &b) { if(b > a) a = b; }
template<typename T, typename U> void chkmin(T &a, const U &b) { if(b < a) a = b; }
double X[15]; double Z[15];
int main() {
double A, B, Xn; int n;
cin >> A >> B >> n >> X[1] >> Xn;
Z[2] = 1;
_rep(i,3,n) {
X[i] = B * X[i - 2] + A * X[i - 1];
Z[i] = B * Z[i - 2] + A * Z[i - 1];
}
double x = (Xn - X[n]) / Z[n];
_rep(i,1,n) printf("%.9lf\n", x * Z[i] + X[i]);
return 0;
}
/*
a list of keywords
clear empty push_back pop_back push pop top front back
emplace_back emplace push_front pop_front insert erase
find count set reset bitset map vector string multiset
first second iterator prev next deque multimap reverse
sort begin end list modify query init check calc prime
putchar getchar puts scanf printf max min swap replace
make_pair make_tuple numeric_limits auto function null
*/
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3808kb
input:
1.0 1.0 10 1 10
output:
1.000000000 -0.323529412 0.676470588 0.352941176 1.029411765 1.382352941 2.411764706 3.794117647 6.205882353 10.000000000
result:
ok 10 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
1 1 2 1 100
output:
1.000000000 100.000000000
result:
ok 2 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
1 1 5 50 100
output:
50.000000000 0.000000000 50.000000000 50.000000000 100.000000000
result:
ok 5 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.25 0.25 10 1 1
output:
1.000000000 55.875536481 14.218884120 17.523605150 7.935622318 6.364806867 3.575107296 2.484978541 1.515021459 1.000000000
result:
ok 10 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
0.25 0.63 6 93 12
output:
93.000000000 -14.204807959 55.038798010 4.810670489 35.877110369 12.000000000
result:
ok 6 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
0.25 0.80 10 5 63
output:
5.000000000 78.769536184 23.692384046 68.938724958 36.188588476 64.198127086 45.000402552 62.608602307 51.652472619 63.000000000
result:
ok 10 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
0.25 0.99 3 18 30
output:
18.000000000 48.720000000 30.000000000
result:
ok 3 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
0.28 0.64 9 6 10
output:
6.000000000 20.950403349 9.706112938 16.125969766 10.727183814 13.324232118 10.596182634 11.494439693 10.000000000
result:
ok 9 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
0.31 0.40 7 10 49
output:
10.000000000 240.115063999 78.435669840 120.361083250 68.686203743 69.437156460 49.000000000
result:
ok 7 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
0.32 0.28 5 36 6
output:
36.000000000 10.121376812 13.318840580 7.096014493 6.000000000
result:
ok 5 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
0.35 0.65 10 86 82
output:
86.000000000 79.533924786 83.736873675 81.004956897 82.780702803 81.626467964 82.376720609 81.889056390 82.206038133 82.000000000
result:
ok 10 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.36 0.68 8 72 59
output:
72.000000000 38.239918643 62.726370711 48.584638133 60.144401812 54.689538583 60.586427122 59.000000000
result:
ok 8 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
0.43 0.61 2 93 84
output:
93.000000000 84.000000000
result:
ok 2 numbers
Test #14:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
0.46 0.96 6 65 35
output:
65.000000000 -16.617423663 54.755985115 9.235026437 56.813857871 35.000000000
result:
ok 6 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
0.50 0.90 4 19 1
output:
19.000000000 -6.565217391 13.817391304 1.000000000
result:
ok 4 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.54 0.35 3 16 22
output:
16.000000000 30.370370370 22.000000000
result:
ok 3 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
0.55 0.89 10 74 13
output:
74.000000000 -48.321937077 39.282934608 -21.400909964 23.191311321 -6.291588641 17.179893323 3.849427437 17.407290148 13.000000000
result:
ok 10 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0.56 0.36 3 31 88
output:
31.000000000 137.214285714 88.000000000
result:
ok 3 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.57 0.93 7 71 48
output:
71.000000000 -34.080565362 46.604077744 -5.130601472 40.417349463 18.266429824 48.000000000
result:
ok 7 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
0.58 0.41 8 30 69
output:
30.000000000 89.432121683 64.170630576 73.886135624 69.163917198 70.408387581 69.194070848 69.000000000
result:
ok 8 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
0.58 0.49 6 31 96
output:
31.000000000 99.557613538 72.933415852 91.084611828 88.566448628 96.000000000
result:
ok 6 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
0.61 0.29 8 62 25
output:
62.000000000 34.407651257 38.968667267 33.749105897 31.887868105 29.238840254 27.083174305 25.000000000
result:
ok 8 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
0.63 0.89 9 37 85
output:
37.000000000 -5.887853302 29.220652420 13.168821585 34.302738252 33.330976310 51.527952120 62.127178751 85.000000000
result:
ok 9 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
0.64 0.67 2 74 42
output:
74.000000000 42.000000000
result:
ok 2 numbers
Test #25:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
0.65 0.56 2 94 96
output:
94.000000000 96.000000000
result:
ok 2 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.65 0.90 10 97 23
output:
97.000000000 -61.703576279 47.192675419 -24.857979629 26.315721118 -5.266962940 20.260623095 8.429138366 23.713500724 23.000000000
result:
ok 10 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
0.67 0.88 4 70 42
output:
70.000000000 0.547821507 61.967040409 42.000000000
result:
ok 4 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.69 0.39 10 2 27
output:
2.000000000 22.365907687 16.212476304 19.909312648 20.060291486 21.606233058 22.731814489 24.111382890 25.502261845 27.000000000
result:
ok 10 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
0.69 0.57 4 88 47
output:
88.000000000 11.843609598 58.332090622 47.000000000
result:
ok 4 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
0.71 0.89 8 4 41
output:
4.000000000 6.838890363 8.415612158 12.061697055 16.053699729 22.133037186 30.002249161 41.000000000
result:
ok 8 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
0.72 0.49 8 21 48
output:
21.000000000 19.940442370 24.647118506 27.516742086 31.889142370 36.443386128 41.864917774 48.000000000
result:
ok 8 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
0.74 0.58 3 57 29
output:
57.000000000 -5.486486486 29.000000000
result:
ok 3 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
0.76 0.70 2 91 18
output:
91.000000000 18.000000000
result:
ok 2 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.77 0.36 10 31 25
output:
31.000000000 5.214972085 15.175528505 13.562546900 15.906351375 17.130407443 18.916700226 20.732805853 22.774272588 25.000000000
result:
ok 10 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
0.77 0.96 8 78 68
output:
78.000000000 -40.097557008 44.004881104 -4.609896277 38.695065727 25.369700183 56.681932239 68.000000000
result:
ok 8 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
0.78 0.52 7 73 77
output:
73.000000000 8.727547506 44.767487055 39.456964606 54.055525661 62.680931611 77.000000000
result:
ok 7 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.78 0.69 4 42 97
output:
42.000000000 57.297905114 73.672365989 97.000000000
result:
ok 4 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.78 0.70 10 54 99
output:
54.000000000 -13.012886351 27.649948646 12.457939498 29.072156861 31.396840001 44.840045003 56.953023103 75.811389523 99.000000000
result:
ok 10 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
0.78 0.76 10 97 83
output:
97.000000000 -43.734736959 39.606905172 -2.345014055 28.272136968 20.270056153 37.297467895 44.497267635 63.053944356 83.000000000
result:
ok 10 numbers
Test #40:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
0.78 0.95 10 100 32
output:
100.000000000 -63.269578817 45.649728522 -24.499311629 24.257779026 -4.353278407 19.649332917 11.190865188 27.395741117 32.000000000
result:
ok 10 numbers
Test #41:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.79 0.90 10 98 42
output:
98.000000000 -58.246914628 42.184937444 -19.096122585 22.880506858 0.889090091 21.294837344 17.623102584 33.087604651 42.000000000
result:
ok 10 numbers
Test #42:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
0.81 0.48 10 97 1
output:
97.000000000 -38.257501682 15.571423638 -5.750747660 2.816177741 -0.479254907 0.963568841 0.550448406 0.908376253 1.000000000
result:
ok 10 numbers
Test #43:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.81 0.86 10 20 100
output:
20.000000000 -3.332842870 14.500397276 8.879076925 19.662393967 23.562545269 35.995320479 49.419998519 70.986174412 100.000000000
result:
ok 10 numbers
Test #44:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
0.84 0.85 10 74 95
output:
74.000000000 -36.290804877 32.415723903 -3.617976067 24.514265422 17.516703297 35.551156378 44.752169160 67.810305016 95.000000000
result:
ok 10 numbers
Test #45:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
0.88 0.37 10 3 96
output:
3.000000000 29.021828490 26.649209072 34.189380524 39.946862218 47.803309546 56.847251421 67.712805782 80.620752114 96.000000000
result:
ok 10 numbers
Test #46:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
0.91 0.50 10 100 98
output:
100.000000000 -22.586857854 29.445959352 15.502394083 28.830158292 33.986641088 45.342922536 58.255380051 75.683857115 98.000000000
result:
ok 10 numbers
Test #47:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
0.94 0.48 10 44 97
output:
44.000000000 -1.582743439 19.632221168 17.694571047 26.056362945 32.986375270 43.514246968 56.736852279 74.219479687 97.000000000
result:
ok 10 numbers
Test #48:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
0.94 0.54 10 28 95
output:
28.000000000 0.452546307 15.545393529 14.857044923 22.360134733 29.041330907 39.373323809 52.693243070 70.793243343 95.000000000
result:
ok 10 numbers
Test #49:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
0.95 0.57 10 2 94
output:
2.000000000 9.227284174 9.905919965 14.670175946 19.583041529 26.965889742 36.779928927 50.311489634 68.760474641 94.000000000
result:
ok 10 numbers
Test #50:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
0.98 0.90 10 21 99
output:
21.000000000 -8.213193485 10.851070385 3.242174841 12.943294690 15.602386153 26.939303651 40.442665115 63.879185098 99.000000000
result:
ok 10 numbers
Extra Test:
score: 0
Extra Test Passed