QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#425063 | #2430. Gem Island | Ender32k | AC ✓ | 46ms | 10476kb | C++14 | 1.3kb | 2024-05-29 21:51:37 | 2024-05-29 21:51:38 |
Judging History
answer
#include <bits/stdc++.h>
#define eb emplace_back
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pi;
typedef tuple<int, int, int> tu;
bool Mbe;
const int N = 550;
int n, d, r;
db f[N][N], g[N][N], C[N][N];
void solve() {
cin >> n >> d >> r;
C[0][0] = 1;
for (int i = 1; i <= n; i++) {
C[i][0] = 1;
for (int j = 1; j <= i; j++)
C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
}
f[n][0] = 1, g[n][0] = r;
for (int i = n; i; i--) {
for (int j = i; j; j--) {
for (int s = 0; s + j <= d; s++) {
f[j][s + j] += f[i][s] * C[i][j];
g[j][s + j] += (g[i][s] + f[i][s] * min(j, r)) * C[i][j];
}
}
}
db a = 0, b = 0;
for (int i = 1; i <= n; i++) a += f[i][d], b += g[i][d];
cout << fixed << setprecision(6) << b / a << '\n';
}
bool Med;
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cerr << (&Mbe - &Med) / 1048576.0 << " MB\n";
#ifdef FILE
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
#endif
int T = 1;
// cin >> T;
while (T--) solve();
cerr << (int)(1e3 * clock() / CLOCKS_PER_SEC) << " ms\n";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 4024kb
Test #2:
score: 0
Accepted
time: 1ms
memory: 3992kb
Test #3:
score: 0
Accepted
time: 1ms
memory: 4048kb
Test #4:
score: 0
Accepted
time: 1ms
memory: 4008kb
Test #5:
score: 0
Accepted
time: 1ms
memory: 3996kb
Test #6:
score: 0
Accepted
time: 1ms
memory: 4016kb
Test #7:
score: 0
Accepted
time: 0ms
memory: 4016kb
Test #8:
score: 0
Accepted
time: 1ms
memory: 4012kb
Test #9:
score: 0
Accepted
time: 1ms
memory: 4020kb
Test #10:
score: 0
Accepted
time: 0ms
memory: 3944kb
Test #11:
score: 0
Accepted
time: 0ms
memory: 4020kb
Test #12:
score: 0
Accepted
time: 1ms
memory: 4016kb
Test #13:
score: 0
Accepted
time: 1ms
memory: 4016kb
Test #14:
score: 0
Accepted
time: 1ms
memory: 4016kb
Test #15:
score: 0
Accepted
time: 1ms
memory: 4016kb
Test #16:
score: 0
Accepted
time: 1ms
memory: 3828kb
Test #17:
score: 0
Accepted
time: 0ms
memory: 4024kb
Test #18:
score: 0
Accepted
time: 1ms
memory: 3952kb
Test #19:
score: 0
Accepted
time: 1ms
memory: 3948kb
Test #20:
score: 0
Accepted
time: 1ms
memory: 4036kb
Test #21:
score: 0
Accepted
time: 1ms
memory: 4036kb
Test #22:
score: 0
Accepted
time: 1ms
memory: 4024kb
Test #23:
score: 0
Accepted
time: 1ms
memory: 3956kb
Test #24:
score: 0
Accepted
time: 1ms
memory: 3964kb
Test #25:
score: 0
Accepted
time: 0ms
memory: 4032kb
Test #26:
score: 0
Accepted
time: 1ms
memory: 4036kb
Test #27:
score: 0
Accepted
time: 1ms
memory: 3992kb
Test #28:
score: 0
Accepted
time: 1ms
memory: 3964kb
Test #29:
score: 0
Accepted
time: 0ms
memory: 4024kb
Test #30:
score: 0
Accepted
time: 1ms
memory: 3980kb
Test #31:
score: 0
Accepted
time: 1ms
memory: 4020kb
Test #32:
score: 0
Accepted
time: 1ms
memory: 4044kb
Test #33:
score: 0
Accepted
time: 1ms
memory: 3972kb
Test #34:
score: 0
Accepted
time: 0ms
memory: 4048kb
Test #35:
score: 0
Accepted
time: 1ms
memory: 4048kb
Test #36:
score: 0
Accepted
time: 1ms
memory: 4056kb
Test #37:
score: 0
Accepted
time: 1ms
memory: 4096kb
Test #38:
score: 0
Accepted
time: 1ms
memory: 3856kb
Test #39:
score: 0
Accepted
time: 1ms
memory: 4008kb
Test #40:
score: 0
Accepted
time: 1ms
memory: 4064kb
Test #41:
score: 0
Accepted
time: 1ms
memory: 4052kb
Test #42:
score: 0
Accepted
time: 1ms
memory: 4072kb
Test #43:
score: 0
Accepted
time: 0ms
memory: 4072kb
Test #44:
score: 0
Accepted
time: 1ms
memory: 4088kb
Test #45:
score: 0
Accepted
time: 1ms
memory: 4088kb
Test #46:
score: 0
Accepted
time: 1ms
memory: 4120kb
Test #47:
score: 0
Accepted
time: 1ms
memory: 4088kb
Test #48:
score: 0
Accepted
time: 1ms
memory: 4120kb
Test #49:
score: 0
Accepted
time: 1ms
memory: 4124kb
Test #50:
score: 0
Accepted
time: 1ms
memory: 4128kb
Test #51:
score: 0
Accepted
time: 1ms
memory: 4156kb
Test #52:
score: 0
Accepted
time: 0ms
memory: 4608kb
Test #53:
score: 0
Accepted
time: 1ms
memory: 4632kb
Test #54:
score: 0
Accepted
time: 2ms
memory: 4656kb
Test #55:
score: 0
Accepted
time: 2ms
memory: 4600kb
Test #56:
score: 0
Accepted
time: 1ms
memory: 4828kb
Test #57:
score: 0
Accepted
time: 1ms
memory: 4388kb
Test #58:
score: 0
Accepted
time: 1ms
memory: 4436kb
Test #59:
score: 0
Accepted
time: 2ms
memory: 5264kb
Test #60:
score: 0
Accepted
time: 2ms
memory: 5176kb
Test #61:
score: 0
Accepted
time: 3ms
memory: 5528kb
Test #62:
score: 0
Accepted
time: 1ms
memory: 4840kb
Test #63:
score: 0
Accepted
time: 0ms
memory: 5068kb
Test #64:
score: 0
Accepted
time: 2ms
memory: 5512kb
Test #65:
score: 0
Accepted
time: 15ms
memory: 7220kb
Test #66:
score: 0
Accepted
time: 11ms
memory: 7620kb
Test #67:
score: 0
Accepted
time: 2ms
memory: 5976kb
Test #68:
score: 0
Accepted
time: 2ms
memory: 5896kb
Test #69:
score: 0
Accepted
time: 2ms
memory: 5896kb
Test #70:
score: 0
Accepted
time: 35ms
memory: 9976kb
Test #71:
score: 0
Accepted
time: 42ms
memory: 10360kb
Test #72:
score: 0
Accepted
time: 46ms
memory: 10420kb
Test #73:
score: 0
Accepted
time: 2ms
memory: 6156kb
Test #74:
score: 0
Accepted
time: 2ms
memory: 6204kb
Test #75:
score: 0
Accepted
time: 0ms
memory: 6220kb
Test #76:
score: 0
Accepted
time: 0ms
memory: 6960kb
Test #77:
score: 0
Accepted
time: 6ms
memory: 7176kb
Test #78:
score: 0
Accepted
time: 3ms
memory: 7204kb
Test #79:
score: 0
Accepted
time: 6ms
memory: 7204kb
Test #80:
score: 0
Accepted
time: 22ms
memory: 8872kb
Test #81:
score: 0
Accepted
time: 43ms
memory: 10300kb
Test #82:
score: 0
Accepted
time: 42ms
memory: 10476kb
Test #83:
score: 0
Accepted
time: 42ms
memory: 10240kb
Test #84:
score: 0
Accepted
time: 43ms
memory: 10240kb