Submission #97425


Source Code Expand

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#define SIZE 60

using namespace std;
typedef long long int ll;

int a[3]={2,3,5};
int b[3];
double dp[SIZE][SIZE][SIZE];

int main()
{
	int n;
	ll d;
	scanf("%d %lld",&n,&d);
	for(int i=0;i<3;i++)
	{
		while(d%a[i]==0)
		{
			d/=a[i];
			b[i]++;
		}
	}
	if(d!=1)
	{
		puts("0");
		return 0;
	}
	dp[0][0][0]=1;
	for(int i=0;i<n;i++)
	{
		for(int j=SIZE-1;j>=0;j--)//2
		{
			for(int k=SIZE-1;k>=0;k--)//3
			{
				for(int l=SIZE-1;l>=0;l--)//5
				{
					dp[j][k][l]/=6;
					if(j>0) dp[j][k][l]+=dp[j-1][k][l]/6;
					if(k>0) dp[j][k][l]+=dp[j][k-1][l]/6;
					if(l>0) dp[j][k][l]+=dp[j][k][l-1]/6;
					if(j>0&&k>0) dp[j][k][l]+=dp[j-1][k-1][l]/6;
					if(j>1) dp[j][k][l]+=dp[j-2][k][l]/6;
				}
			}
		}
	}
	double ret=0;
	for(int i=b[0];i<SIZE;i++)
	{
		for(int j=b[1];j<SIZE;j++)
		{
			for(int k=b[2];k<SIZE;k++)
			{
				ret+=dp[i][j][k];
			}
		}
	}
	printf("%.8f\n",ret);
	return 0;
}

Submission Info

Submission Time
Task D - サイコロ
User yutaka1999
Language C++ (G++ 4.6.4)
Score 0
Code Size 1016 Byte
Status WA
Exec Time 498 ms
Memory 2396 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:17:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name All
Score / Max Score 0 / 4
Status
AC × 7
WA × 6
Set Name Test Cases
All 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 90, 91
Case Name Status Exec Time Memory
00 AC 121 ms 2396 KB
01 WA 437 ms 2224 KB
02 WA 413 ms 2336 KB
03 AC 132 ms 2320 KB
04 AC 128 ms 2228 KB
05 WA 498 ms 2232 KB
06 WA 435 ms 2312 KB
07 WA 432 ms 2312 KB
08 AC 73 ms 2312 KB
09 WA 380 ms 2228 KB
10 AC 19 ms 648 KB
90 AC 29 ms 2240 KB
91 AC 32 ms 2240 KB