QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#397101#2430. Gem IslandzhouhuanyiAC ✓1224ms19536kbC++14968b2024-04-23 16:38:502024-04-23 16:38:51

Judging History

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

  • [2024-04-23 16:38:51]
  • 评测
  • 测评结果:AC
  • 用时:1224ms
  • 内存:19536kb
  • [2024-04-23 16:38:50]
  • 提交

answer

#include<iostream>
#include<cstdio>
#define N 1000
using namespace std;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
int n,d,r;
double ans,C[N+1][N+1],dp[N+1][N+1][2];
int main()
{
	int cnt;
	double res;
	for (int i=0;i<=N;++i) C[i][0]=1;
	for (int i=1;i<=N;++i)
		for (int j=1;j<=i;++j)
			C[i][j]=C[i-1][j-1]+C[i-1][j];
	n=read(),d=read(),r=read(),dp[0][0][0]=1;
	for (int i=d;i>=1;--i)
		for (int j=n;j>=1;--j)
			for (int t=0;t<=d;++t)
			{
				res=1;
				for (int k=1;k<=min(j,t/i);++k)
				{
					cnt=max(min(r-(j-k),k),0)*i,res*=C[t-(k-1)*i][i]/C[n+t-(k-1)*i-1][i];
					dp[j][t][0]+=dp[j-k][t-i*k][0]*res*C[j][k];
					dp[j][t][1]+=dp[j-k][t-i*k][0]*res*C[j][k]*cnt;
					dp[j][t][1]+=dp[j-k][t-i*k][1]*res*C[j][k];
				}
			}
	ans=r;
	for (int i=0;i<=n;++i) ans+=dp[i][d][1]*C[n][i];
	printf("%0.12lf\n",ans);
	return 0;
}

Details

Test #1:

score: 100
Accepted
time: 0ms
memory: 11884kb

Test #2:

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

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

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

Test #10:

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

Test #11:

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

Test #12:

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

Test #13:

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

Test #14:

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

Test #15:

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

Test #16:

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

Test #17:

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

Test #18:

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

Test #19:

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

Test #20:

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

Test #21:

score: 0
Accepted
time: 5ms
memory: 13372kb

Test #22:

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

Test #23:

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

Test #24:

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

Test #25:

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

Test #26:

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

Test #27:

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

Test #28:

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

Test #29:

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

Test #30:

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

Test #31:

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

Test #32:

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

Test #33:

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

Test #34:

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

Test #35:

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

Test #36:

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

Test #37:

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

Test #38:

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

Test #39:

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

Test #40:

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

Test #41:

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

Test #42:

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

Test #43:

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

Test #44:

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

Test #45:

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

Test #46:

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

Test #47:

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

Test #48:

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

Test #49:

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

Test #50:

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

Test #51:

score: 0
Accepted
time: 19ms
memory: 12720kb

Test #52:

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

Test #53:

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

Test #54:

score: 0
Accepted
time: 87ms
memory: 13592kb

Test #55:

score: 0
Accepted
time: 87ms
memory: 13068kb

Test #56:

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

Test #57:

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

Test #58:

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

Test #59:

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

Test #60:

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

Test #61:

score: 0
Accepted
time: 76ms
memory: 12848kb

Test #62:

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

Test #63:

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

Test #64:

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

Test #65:

score: 0
Accepted
time: 540ms
memory: 14896kb

Test #66:

score: 0
Accepted
time: 197ms
memory: 14224kb

Test #67:

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

Test #68:

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

Test #69:

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

Test #70:

score: 0
Accepted
time: 938ms
memory: 18628kb

Test #71:

score: 0
Accepted
time: 1183ms
memory: 17576kb

Test #72:

score: 0
Accepted
time: 1190ms
memory: 18308kb

Test #73:

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

Test #74:

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

Test #75:

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

Test #76:

score: 0
Accepted
time: 34ms
memory: 15172kb

Test #77:

score: 0
Accepted
time: 59ms
memory: 16636kb

Test #78:

score: 0
Accepted
time: 60ms
memory: 16308kb

Test #79:

score: 0
Accepted
time: 63ms
memory: 16668kb

Test #80:

score: 0
Accepted
time: 488ms
memory: 17316kb

Test #81:

score: 0
Accepted
time: 1224ms
memory: 18400kb

Test #82:

score: 0
Accepted
time: 1185ms
memory: 18636kb

Test #83:

score: 0
Accepted
time: 1203ms
memory: 17936kb

Test #84:

score: 0
Accepted
time: 1192ms
memory: 19536kb