QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#369329 | #2430. Gem Island | InfinityNS | AC ✓ | 237ms | 35120kb | C++14 | 1.0kb | 2024-03-28 00:34:42 | 2024-03-28 00:34:44 |
Judging History
answer
#include<bits/stdc++.h>
#define f first
#define s second
#define ld long double
#define pb push_back
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
const int N=1001;
int n,d,r;
ld nck[N][N],dp[N][N];
int main(){
scanf("%i %i %i",&n,&d,&r);
for(int k=0;k<=n+d;k++){
for(int sum=0;sum<=n+d;sum++){
if(sum<k)nck[sum][k]=0;
else{
if(sum==0||k==0)nck[sum][k]=1;
else{
nck[sum][k]=nck[sum-1][k-1]+nck[sum-1][k];
}
}
}
}
for(int sum=0;sum<=n+d;sum++)
dp[sum][0]=0;
for(int k=1;k<=n;k++){
for(int sum=0;sum<=n+d;sum++){
dp[sum][k]=0;
if(sum>=k){
dp[sum][k]+=min(k,r)*nck[sum-1][k-1];
for(int jed=0;jed<=k;jed++){
dp[sum][k]+=nck[k][jed]*dp[sum-k][k-jed];
}
}
}
}
printf("%.10Lf\n",(ld)dp[n+d][n]/nck[d+n-1][n-1]);
}
Details
Test #1:
score: 100
Accepted
time: 0ms
memory: 5876kb
Test #2:
score: 0
Accepted
time: 1ms
memory: 5940kb
Test #3:
score: 0
Accepted
time: 1ms
memory: 7980kb
Test #4:
score: 0
Accepted
time: 1ms
memory: 5976kb
Test #5:
score: 0
Accepted
time: 1ms
memory: 5976kb
Test #6:
score: 0
Accepted
time: 1ms
memory: 5904kb
Test #7:
score: 0
Accepted
time: 0ms
memory: 10156kb
Test #8:
score: 0
Accepted
time: 0ms
memory: 20304kb
Test #9:
score: 0
Accepted
time: 4ms
memory: 20556kb
Test #10:
score: 0
Accepted
time: 0ms
memory: 22304kb
Test #11:
score: 0
Accepted
time: 0ms
memory: 5868kb
Test #12:
score: 0
Accepted
time: 1ms
memory: 5916kb
Test #13:
score: 0
Accepted
time: 0ms
memory: 5984kb
Test #14:
score: 0
Accepted
time: 1ms
memory: 5976kb
Test #15:
score: 0
Accepted
time: 1ms
memory: 6008kb
Test #16:
score: 0
Accepted
time: 0ms
memory: 5968kb
Test #17:
score: 0
Accepted
time: 1ms
memory: 10048kb
Test #18:
score: 0
Accepted
time: 0ms
memory: 10416kb
Test #19:
score: 0
Accepted
time: 2ms
memory: 14364kb
Test #20:
score: 0
Accepted
time: 0ms
memory: 22668kb
Test #21:
score: 0
Accepted
time: 2ms
memory: 22312kb
Test #22:
score: 0
Accepted
time: 1ms
memory: 5912kb
Test #23:
score: 0
Accepted
time: 0ms
memory: 5932kb
Test #24:
score: 0
Accepted
time: 1ms
memory: 7984kb
Test #25:
score: 0
Accepted
time: 1ms
memory: 6008kb
Test #26:
score: 0
Accepted
time: 0ms
memory: 10140kb
Test #27:
score: 0
Accepted
time: 1ms
memory: 8416kb
Test #28:
score: 0
Accepted
time: 0ms
memory: 10316kb
Test #29:
score: 0
Accepted
time: 1ms
memory: 5968kb
Test #30:
score: 0
Accepted
time: 1ms
memory: 5988kb
Test #31:
score: 0
Accepted
time: 0ms
memory: 6000kb
Test #32:
score: 0
Accepted
time: 1ms
memory: 5984kb
Test #33:
score: 0
Accepted
time: 0ms
memory: 5952kb
Test #34:
score: 0
Accepted
time: 1ms
memory: 5964kb
Test #35:
score: 0
Accepted
time: 1ms
memory: 10080kb
Test #36:
score: 0
Accepted
time: 1ms
memory: 6160kb
Test #37:
score: 0
Accepted
time: 1ms
memory: 8052kb
Test #38:
score: 0
Accepted
time: 0ms
memory: 10180kb
Test #39:
score: 0
Accepted
time: 1ms
memory: 6016kb
Test #40:
score: 0
Accepted
time: 0ms
memory: 6048kb
Test #41:
score: 0
Accepted
time: 1ms
memory: 8196kb
Test #42:
score: 0
Accepted
time: 0ms
memory: 8228kb
Test #43:
score: 0
Accepted
time: 0ms
memory: 22580kb
Test #44:
score: 0
Accepted
time: 1ms
memory: 6032kb
Test #45:
score: 0
Accepted
time: 1ms
memory: 5964kb
Test #46:
score: 0
Accepted
time: 0ms
memory: 6040kb
Test #47:
score: 0
Accepted
time: 1ms
memory: 8068kb
Test #48:
score: 0
Accepted
time: 0ms
memory: 6168kb
Test #49:
score: 0
Accepted
time: 0ms
memory: 22716kb
Test #50:
score: 0
Accepted
time: 0ms
memory: 22344kb
Test #51:
score: 0
Accepted
time: 0ms
memory: 22752kb
Test #52:
score: 0
Accepted
time: 0ms
memory: 12380kb
Test #53:
score: 0
Accepted
time: 2ms
memory: 10664kb
Test #54:
score: 0
Accepted
time: 0ms
memory: 22828kb
Test #55:
score: 0
Accepted
time: 0ms
memory: 22392kb
Test #56:
score: 0
Accepted
time: 3ms
memory: 12128kb
Test #57:
score: 0
Accepted
time: 0ms
memory: 10568kb
Test #58:
score: 0
Accepted
time: 2ms
memory: 10092kb
Test #59:
score: 0
Accepted
time: 0ms
memory: 12248kb
Test #60:
score: 0
Accepted
time: 2ms
memory: 12248kb
Test #61:
score: 0
Accepted
time: 5ms
memory: 20704kb
Test #62:
score: 0
Accepted
time: 2ms
memory: 12728kb
Test #63:
score: 0
Accepted
time: 7ms
memory: 14248kb
Test #64:
score: 0
Accepted
time: 11ms
memory: 16868kb
Test #65:
score: 0
Accepted
time: 53ms
memory: 30596kb
Test #66:
score: 0
Accepted
time: 45ms
memory: 25392kb
Test #67:
score: 0
Accepted
time: 36ms
memory: 18928kb
Test #68:
score: 0
Accepted
time: 37ms
memory: 20292kb
Test #69:
score: 0
Accepted
time: 39ms
memory: 18808kb
Test #70:
score: 0
Accepted
time: 201ms
memory: 34020kb
Test #71:
score: 0
Accepted
time: 224ms
memory: 34684kb
Test #72:
score: 0
Accepted
time: 231ms
memory: 34816kb
Test #73:
score: 0
Accepted
time: 58ms
memory: 21728kb
Test #74:
score: 0
Accepted
time: 58ms
memory: 22436kb
Test #75:
score: 0
Accepted
time: 57ms
memory: 22780kb
Test #76:
score: 0
Accepted
time: 96ms
memory: 26432kb
Test #77:
score: 0
Accepted
time: 96ms
memory: 25788kb
Test #78:
score: 0
Accepted
time: 104ms
memory: 26440kb
Test #79:
score: 0
Accepted
time: 100ms
memory: 26792kb
Test #80:
score: 0
Accepted
time: 170ms
memory: 34100kb
Test #81:
score: 0
Accepted
time: 229ms
memory: 34812kb
Test #82:
score: 0
Accepted
time: 233ms
memory: 34868kb
Test #83:
score: 0
Accepted
time: 232ms
memory: 35120kb
Test #84:
score: 0
Accepted
time: 237ms
memory: 34944kb