Submission #1303564


Source Code Expand

#include<iostream>
#include<vector>
#include<string>
#include<stdio.h>
#include<string.h>
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) FOR((i),0,(n))

typedef long long ll;

const int INF=1e9+7;
const int MAX_N=1e2+10;
long double dp[2][2*MAX_N][MAX_N][MAX_N];

ll divi(ll n,ll d){
	if(n%d!=0)return 0;
	else return divi(n/d,d)+1;
}
ll di(ll n,ll d){
	if(n%d!=0)return n;
	else return di(n/d,d);
}
int main(){
	ll n,d;
	cin>>n>>d;
	if(di(di(di(d,5),3),2)!=1)cout<<0<<endl;
	long double ans=0;
	int i_m=divi(d,2),j_m=divi(d,3),k_m=divi(d,5);
	dp[0][0][0][0]=1;
	int cur=0;
	rep(i,n){
		int next=cur^1;
		memset(dp[next],0,sizeof(dp[next]));
		rep(j,2*i+1)rep(k,i+1)rep(l,i+1)if(dp[cur][j][k][l]){
			FOR(m,1,7)dp[next][j+divi(m,2)][k+divi(m,3)][l+divi(m,5)]+=dp[cur][j][k][l];
		}
		cur=next;
	}
	FOR(i,i_m,201)FOR(j,j_m,101)FOR(k,k_m,101)ans+=dp[cur][i][j][k];
	rep(i,n)ans/=6.0;
	printf("%.9f\n",(double)ans);
}

Submission Info

Submission Time
Task D - サイコロ
User ryogo108
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1001 Byte
Status WA
Exec Time 1195 ms
Memory 83584 KB

Judge Result

Set Name All
Score / Max Score 0 / 4
Status
AC × 12
WA × 1
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 178 ms 83584 KB
01 AC 759 ms 83456 KB
02 AC 628 ms 83456 KB
03 AC 202 ms 83456 KB
04 AC 196 ms 83456 KB
05 AC 915 ms 83456 KB
06 AC 730 ms 83456 KB
07 AC 659 ms 83456 KB
08 AC 97 ms 83456 KB
09 AC 606 ms 83456 KB
10 WA 1195 ms 83456 KB
90 AC 26 ms 83456 KB
91 AC 31 ms 83456 KB