QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#397113#2430. Gem IslandzhouhuanyiAC ✓860ms19316kbC++14889b2024-04-23 16:49:142024-04-23 16:49:14

Judging History

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

  • [2024-04-23 16:49:14]
  • 评测
  • 测评结果:AC
  • 用时:860ms
  • 内存:19316kb
  • [2024-04-23 16:49:14]
  • 提交

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;
	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)
				for (int k=1;k<=min(j,t/i);++k)
				{
					cnt=max(min(r-(j-k),k),0)*i;
					dp[j][t][0]+=dp[j-k][t-i*k][0]*C[j][k];
					dp[j][t][1]+=dp[j-k][t-i*k][0]*C[j][k]*cnt;
					dp[j][t][1]+=dp[j-k][t-i*k][1]*C[j][k];
				}
	ans=r;
	for (int i=0;i<=n;++i) ans+=dp[i][d][1]*C[n][i]/C[n+d-1][d];
	printf("%0.12lf\n",ans);
	return 0;
}

Details

Test #1:

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

Test #2:

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

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

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

Test #10:

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

Test #11:

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

Test #12:

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

Test #13:

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

Test #14:

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

Test #15:

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

Test #16:

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

Test #17:

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

Test #18:

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

Test #19:

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

Test #20:

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

Test #21:

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

Test #22:

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

Test #23:

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

Test #24:

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

Test #25:

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

Test #26:

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

Test #27:

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

Test #28:

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

Test #29:

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

Test #30:

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

Test #31:

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

Test #32:

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

Test #33:

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

Test #34:

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

Test #35:

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

Test #36:

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

Test #37:

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

Test #38:

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

Test #39:

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

Test #40:

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

Test #41:

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

Test #42:

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

Test #43:

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

Test #44:

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

Test #45:

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

Test #46:

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

Test #47:

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

Test #48:

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

Test #49:

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

Test #50:

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

Test #51:

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

Test #52:

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

Test #53:

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

Test #54:

score: 0
Accepted
time: 56ms
memory: 13180kb

Test #55:

score: 0
Accepted
time: 56ms
memory: 13556kb

Test #56:

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

Test #57:

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

Test #58:

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

Test #59:

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

Test #60:

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

Test #61:

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

Test #62:

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

Test #63:

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

Test #64:

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

Test #65:

score: 0
Accepted
time: 389ms
memory: 16464kb

Test #66:

score: 0
Accepted
time: 146ms
memory: 15812kb

Test #67:

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

Test #68:

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

Test #69:

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

Test #70:

score: 0
Accepted
time: 668ms
memory: 17404kb

Test #71:

score: 0
Accepted
time: 837ms
memory: 19316kb

Test #72:

score: 0
Accepted
time: 848ms
memory: 18200kb

Test #73:

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

Test #74:

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

Test #75:

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

Test #76:

score: 0
Accepted
time: 28ms
memory: 14824kb

Test #77:

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

Test #78:

score: 0
Accepted
time: 47ms
memory: 14892kb

Test #79:

score: 0
Accepted
time: 43ms
memory: 14644kb

Test #80:

score: 0
Accepted
time: 359ms
memory: 16976kb

Test #81:

score: 0
Accepted
time: 860ms
memory: 18076kb

Test #82:

score: 0
Accepted
time: 857ms
memory: 18152kb

Test #83:

score: 0
Accepted
time: 857ms
memory: 18996kb

Test #84:

score: 0
Accepted
time: 853ms
memory: 18884kb