QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#297467 | #2430. Gem Island | LYT0122 | AC ✓ | 194ms | 10004kb | C++14 | 1.4kb | 2024-01-04 15:30:05 | 2024-01-04 15:30:05 |
Judging History
answer
#include <iostream>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
const int N=510,INF=1e9;
const double eps=1e-5;
typedef pair <int,int> PII;
inline int read()
{
int x=0,f=1;char c=getchar();
while(c<'0' || c>'9') {if(c=='-') f=-1;c=getchar();}
while(c>='0' && c<='9') {x=x*10+c-48,c=getchar();}
return x*f;
}
inline ll readll()
{
ll x=0,f=1;char c=getchar();
while(c<'0' || c>'9') {if(c=='-') f=-1;c=getchar();}
while(c>='0' && c<='9') {x=x*10+c-48,c=getchar();}
return x*f;
}
int n,d,r;
double f[N][N],g[N][N],C[N][N],a,b;
int main()
{
// #define FILEIO
#ifdef FILEIO
freopen("in.in","r",stdin);
freopen("out.out","w",stdout);
#endif
n=read(),d=read(),r=read();
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;
for(int s=0;s<d;s++)
{
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i && s+j<=d;j++)
{
f[j][s+j]+=f[i][s]*C[i][j];
g[j][s+j]+=(g[i][s]+f[i][s]*min(r,j))*C[i][j];
}
}
}
for(int i=1;i<=n;i++) a+=f[i][d],b+=g[i][d];
printf("%.7lf",b/a+r);
cerr<<endl<<1e3*clock()/CLOCKS_PER_SEC<<"ms";
return 0;
}
Details
Test #1:
score: 100
Accepted
time: 1ms
memory: 5996kb
Test #2:
score: 0
Accepted
time: 0ms
memory: 6028kb
Test #3:
score: 0
Accepted
time: 1ms
memory: 6064kb
Test #4:
score: 0
Accepted
time: 1ms
memory: 6008kb
Test #5:
score: 0
Accepted
time: 1ms
memory: 5832kb
Test #6:
score: 0
Accepted
time: 0ms
memory: 5796kb
Test #7:
score: 0
Accepted
time: 1ms
memory: 5892kb
Test #8:
score: 0
Accepted
time: 0ms
memory: 5948kb
Test #9:
score: 0
Accepted
time: 1ms
memory: 6016kb
Test #10:
score: 0
Accepted
time: 0ms
memory: 6036kb
Test #11:
score: 0
Accepted
time: 0ms
memory: 5952kb
Test #12:
score: 0
Accepted
time: 1ms
memory: 5932kb
Test #13:
score: 0
Accepted
time: 1ms
memory: 6000kb
Test #14:
score: 0
Accepted
time: 1ms
memory: 6016kb
Test #15:
score: 0
Accepted
time: 1ms
memory: 5840kb
Test #16:
score: 0
Accepted
time: 1ms
memory: 5840kb
Test #17:
score: 0
Accepted
time: 1ms
memory: 5952kb
Test #18:
score: 0
Accepted
time: 1ms
memory: 6020kb
Test #19:
score: 0
Accepted
time: 1ms
memory: 5988kb
Test #20:
score: 0
Accepted
time: 0ms
memory: 6008kb
Test #21:
score: 0
Accepted
time: 1ms
memory: 5900kb
Test #22:
score: 0
Accepted
time: 1ms
memory: 5896kb
Test #23:
score: 0
Accepted
time: 1ms
memory: 5996kb
Test #24:
score: 0
Accepted
time: 1ms
memory: 5848kb
Test #25:
score: 0
Accepted
time: 0ms
memory: 6060kb
Test #26:
score: 0
Accepted
time: 0ms
memory: 6012kb
Test #27:
score: 0
Accepted
time: 1ms
memory: 6008kb
Test #28:
score: 0
Accepted
time: 1ms
memory: 6028kb
Test #29:
score: 0
Accepted
time: 1ms
memory: 6004kb
Test #30:
score: 0
Accepted
time: 1ms
memory: 5956kb
Test #31:
score: 0
Accepted
time: 1ms
memory: 6004kb
Test #32:
score: 0
Accepted
time: 1ms
memory: 5856kb
Test #33:
score: 0
Accepted
time: 0ms
memory: 8052kb
Test #34:
score: 0
Accepted
time: 1ms
memory: 6056kb
Test #35:
score: 0
Accepted
time: 0ms
memory: 6020kb
Test #36:
score: 0
Accepted
time: 1ms
memory: 6072kb
Test #37:
score: 0
Accepted
time: 1ms
memory: 5904kb
Test #38:
score: 0
Accepted
time: 1ms
memory: 6064kb
Test #39:
score: 0
Accepted
time: 1ms
memory: 5976kb
Test #40:
score: 0
Accepted
time: 1ms
memory: 6016kb
Test #41:
score: 0
Accepted
time: 1ms
memory: 5916kb
Test #42:
score: 0
Accepted
time: 1ms
memory: 6032kb
Test #43:
score: 0
Accepted
time: 1ms
memory: 5976kb
Test #44:
score: 0
Accepted
time: 0ms
memory: 6036kb
Test #45:
score: 0
Accepted
time: 1ms
memory: 6040kb
Test #46:
score: 0
Accepted
time: 0ms
memory: 6060kb
Test #47:
score: 0
Accepted
time: 0ms
memory: 4104kb
Test #48:
score: 0
Accepted
time: 1ms
memory: 6080kb
Test #49:
score: 0
Accepted
time: 1ms
memory: 6108kb
Test #50:
score: 0
Accepted
time: 1ms
memory: 6092kb
Test #51:
score: 0
Accepted
time: 1ms
memory: 5988kb
Test #52:
score: 0
Accepted
time: 2ms
memory: 6360kb
Test #53:
score: 0
Accepted
time: 0ms
memory: 8240kb
Test #54:
score: 0
Accepted
time: 4ms
memory: 6400kb
Test #55:
score: 0
Accepted
time: 2ms
memory: 8252kb
Test #56:
score: 0
Accepted
time: 1ms
memory: 6448kb
Test #57:
score: 0
Accepted
time: 1ms
memory: 6232kb
Test #58:
score: 0
Accepted
time: 0ms
memory: 6324kb
Test #59:
score: 0
Accepted
time: 3ms
memory: 6788kb
Test #60:
score: 0
Accepted
time: 3ms
memory: 6640kb
Test #61:
score: 0
Accepted
time: 6ms
memory: 6984kb
Test #62:
score: 0
Accepted
time: 1ms
memory: 6684kb
Test #63:
score: 0
Accepted
time: 1ms
memory: 6068kb
Test #64:
score: 0
Accepted
time: 3ms
memory: 7180kb
Test #65:
score: 0
Accepted
time: 62ms
memory: 7980kb
Test #66:
score: 0
Accepted
time: 39ms
memory: 8100kb
Test #67:
score: 0
Accepted
time: 3ms
memory: 7600kb
Test #68:
score: 0
Accepted
time: 1ms
memory: 6380kb
Test #69:
score: 0
Accepted
time: 1ms
memory: 6340kb
Test #70:
score: 0
Accepted
time: 162ms
memory: 9612kb
Test #71:
score: 0
Accepted
time: 182ms
memory: 9804kb
Test #72:
score: 0
Accepted
time: 194ms
memory: 10004kb
Test #73:
score: 0
Accepted
time: 1ms
memory: 6432kb
Test #74:
score: 0
Accepted
time: 2ms
memory: 7672kb
Test #75:
score: 0
Accepted
time: 0ms
memory: 7644kb
Test #76:
score: 0
Accepted
time: 9ms
memory: 7788kb
Test #77:
score: 0
Accepted
time: 17ms
memory: 6904kb
Test #78:
score: 0
Accepted
time: 17ms
memory: 7448kb
Test #79:
score: 0
Accepted
time: 17ms
memory: 8112kb
Test #80:
score: 0
Accepted
time: 101ms
memory: 8644kb
Test #81:
score: 0
Accepted
time: 191ms
memory: 9916kb
Test #82:
score: 0
Accepted
time: 190ms
memory: 9896kb
Test #83:
score: 0
Accepted
time: 191ms
memory: 10004kb
Test #84:
score: 0
Accepted
time: 190ms
memory: 9800kb