Submission #1303563


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;
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 996 Byte
Status WA
Exec Time 714 ms
Memory 41856 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 93 ms 41856 KB
01 AC 439 ms 41856 KB
02 AC 351 ms 41856 KB
03 AC 107 ms 41856 KB
04 AC 102 ms 41856 KB
05 AC 529 ms 41856 KB
06 AC 417 ms 41856 KB
07 AC 368 ms 41856 KB
08 AC 50 ms 41856 KB
09 AC 346 ms 41856 KB
10 WA 714 ms 41856 KB
90 AC 14 ms 41856 KB
91 AC 16 ms 41856 KB