QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#53532#2430. Gem Islandnot_so_organicAC ✓20ms9708kbC++11836b2022-10-05 13:11:252022-10-05 13:11:27

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-05 13:11:27]
  • 评测
  • 测评结果:AC
  • 用时:20ms
  • 内存:9708kb
  • [2022-10-05 13:11:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int n, d, r;
double ans, tot;
double C[N][N], f[N][N], g[N][N];
int main() {
    scanf("%d%d%d", &n, &d, &r);
    f[0][n] = r;
    g[0][n] = 1;

    for (int i = 0; i <= n; ++i)
        for (int j = C[i][0] = 1; j <= i; ++j)
            C[i][j] = C[i - 1][j - 1] + C[i - 1][j];

    for (int j = 0; j <= d; ++j) {
        for (int k = 1; k <= n; ++k)
            if (g[j][k]) {
                for (int p = 1; p <= k && j + p <= d; ++p) {
                    g[j + p][p] += g[j][k] * C[k][p];
                    f[j + p][p] += f[j][k] * C[k][p] + g[j][k] * C[k][p] * min(p, r);
                }
            }
    }

    for (int p = 1; p <= n; ++p)
        ans += f[d][p], tot += g[d][p];

    printf("%.8lf\n", ans / tot);
    return 0;
}

Details

Test #1:

score: 100
Accepted
time: 2ms
memory: 7844kb

Test #2:

score: 0
Accepted
time: 3ms
memory: 7880kb

Test #3:

score: 0
Accepted
time: 3ms
memory: 7876kb

Test #4:

score: 0
Accepted
time: 3ms
memory: 7912kb

Test #5:

score: 0
Accepted
time: 0ms
memory: 7872kb

Test #6:

score: 0
Accepted
time: 2ms
memory: 7836kb

Test #7:

score: 0
Accepted
time: 3ms
memory: 8064kb

Test #8:

score: 0
Accepted
time: 4ms
memory: 8988kb

Test #9:

score: 0
Accepted
time: 2ms
memory: 9708kb

Test #10:

score: 0
Accepted
time: 2ms
memory: 9496kb

Test #11:

score: 0
Accepted
time: 3ms
memory: 7856kb

Test #12:

score: 0
Accepted
time: 0ms
memory: 7872kb

Test #13:

score: 0
Accepted
time: 0ms
memory: 5696kb

Test #14:

score: 0
Accepted
time: 2ms
memory: 5764kb

Test #15:

score: 0
Accepted
time: 3ms
memory: 8056kb

Test #16:

score: 0
Accepted
time: 3ms
memory: 7920kb

Test #17:

score: 0
Accepted
time: 3ms
memory: 7992kb

Test #18:

score: 0
Accepted
time: 3ms
memory: 8364kb

Test #19:

score: 0
Accepted
time: 4ms
memory: 8976kb

Test #20:

score: 0
Accepted
time: 3ms
memory: 8440kb

Test #21:

score: 0
Accepted
time: 0ms
memory: 8300kb

Test #22:

score: 0
Accepted
time: 0ms
memory: 7868kb

Test #23:

score: 0
Accepted
time: 3ms
memory: 7948kb

Test #24:

score: 0
Accepted
time: 1ms
memory: 7876kb

Test #25:

score: 0
Accepted
time: 2ms
memory: 7916kb

Test #26:

score: 0
Accepted
time: 2ms
memory: 8176kb

Test #27:

score: 0
Accepted
time: 0ms
memory: 8264kb

Test #28:

score: 0
Accepted
time: 3ms
memory: 8340kb

Test #29:

score: 0
Accepted
time: 3ms
memory: 7884kb

Test #30:

score: 0
Accepted
time: 3ms
memory: 7912kb

Test #31:

score: 0
Accepted
time: 2ms
memory: 7740kb

Test #32:

score: 0
Accepted
time: 2ms
memory: 5820kb

Test #33:

score: 0
Accepted
time: 3ms
memory: 7984kb

Test #34:

score: 0
Accepted
time: 3ms
memory: 7876kb

Test #35:

score: 0
Accepted
time: 1ms
memory: 8236kb

Test #36:

score: 0
Accepted
time: 0ms
memory: 6160kb

Test #37:

score: 0
Accepted
time: 2ms
memory: 8068kb

Test #38:

score: 0
Accepted
time: 4ms
memory: 6104kb

Test #39:

score: 0
Accepted
time: 0ms
memory: 5844kb

Test #40:

score: 0
Accepted
time: 1ms
memory: 5900kb

Test #41:

score: 0
Accepted
time: 2ms
memory: 5992kb

Test #42:

score: 0
Accepted
time: 2ms
memory: 6092kb

Test #43:

score: 0
Accepted
time: 1ms
memory: 7748kb

Test #44:

score: 0
Accepted
time: 0ms
memory: 5884kb

Test #45:

score: 0
Accepted
time: 2ms
memory: 5880kb

Test #46:

score: 0
Accepted
time: 3ms
memory: 5896kb

Test #47:

score: 0
Accepted
time: 2ms
memory: 4316kb

Test #48:

score: 0
Accepted
time: 3ms
memory: 4364kb

Test #49:

score: 0
Accepted
time: 2ms
memory: 7768kb

Test #50:

score: 0
Accepted
time: 6ms
memory: 7764kb

Test #51:

score: 0
Accepted
time: 2ms
memory: 7696kb

Test #52:

score: 0
Accepted
time: 2ms
memory: 5324kb

Test #53:

score: 0
Accepted
time: 3ms
memory: 4596kb

Test #54:

score: 0
Accepted
time: 2ms
memory: 7888kb

Test #55:

score: 0
Accepted
time: 2ms
memory: 7888kb

Test #56:

score: 0
Accepted
time: 0ms
memory: 4684kb

Test #57:

score: 0
Accepted
time: 2ms
memory: 4052kb

Test #58:

score: 0
Accepted
time: 2ms
memory: 4284kb

Test #59:

score: 0
Accepted
time: 2ms
memory: 4952kb

Test #60:

score: 0
Accepted
time: 3ms
memory: 4836kb

Test #61:

score: 0
Accepted
time: 2ms
memory: 6460kb

Test #62:

score: 0
Accepted
time: 0ms
memory: 4520kb

Test #63:

score: 0
Accepted
time: 0ms
memory: 4804kb

Test #64:

score: 0
Accepted
time: 3ms
memory: 5132kb

Test #65:

score: 0
Accepted
time: 10ms
memory: 8580kb

Test #66:

score: 0
Accepted
time: 7ms
memory: 7168kb

Test #67:

score: 0
Accepted
time: 3ms
memory: 5800kb

Test #68:

score: 0
Accepted
time: 3ms
memory: 5444kb

Test #69:

score: 0
Accepted
time: 1ms
memory: 5404kb

Test #70:

score: 0
Accepted
time: 8ms
memory: 9292kb

Test #71:

score: 0
Accepted
time: 10ms
memory: 9652kb

Test #72:

score: 0
Accepted
time: 14ms
memory: 9680kb

Test #73:

score: 0
Accepted
time: 3ms
memory: 5756kb

Test #74:

score: 0
Accepted
time: 1ms
memory: 5772kb

Test #75:

score: 0
Accepted
time: 3ms
memory: 5844kb

Test #76:

score: 0
Accepted
time: 4ms
memory: 6684kb

Test #77:

score: 0
Accepted
time: 0ms
memory: 6720kb

Test #78:

score: 0
Accepted
time: 0ms
memory: 6716kb

Test #79:

score: 0
Accepted
time: 4ms
memory: 6764kb

Test #80:

score: 0
Accepted
time: 3ms
memory: 8384kb

Test #81:

score: 0
Accepted
time: 15ms
memory: 9708kb

Test #82:

score: 0
Accepted
time: 11ms
memory: 9688kb

Test #83:

score: 0
Accepted
time: 8ms
memory: 9708kb

Test #84:

score: 0
Accepted
time: 20ms
memory: 9668kb