Submission #3412956
Source Code Expand
import bisect import collections import heapq import itertools import operator import sys import numpy as np def main(): n, d = map(int, sys.stdin.readline().split()) ns = [] while True: for i in [2, 3, 5]: div, mod = divmod(d, i) if mod == 0: ns.append(i) d = div break else: if d != 1: print("{:.8f}".format(0)) return break dp = np.zeros((101, 61, 40, 30)) dp[0][0][0][0] = 1 for l in range(n): for i in range(59): for j in range(39): for k in range(29): dp[l + 1][i][j][k] += dp[l][i][j][k] dp[l + 1][i + 1][j][k] += dp[l][i][j][k] dp[l + 1][i][j + 1][k] += dp[l][i][j][k] dp[l + 1][i + 2][j][k] += dp[l][i][j][k] dp[l + 1][i][j][k + 1] += dp[l][i][j][k] dp[l + 1][i + 1][j + 1][k] += dp[l][i][j][k] ans = 0 n2 = ns.count(2) n3 = ns.count(3) n5 = ns.count(5) for i in range(n2, 61): for j in range(n3, 40): for k in range(n5, 30): ans += dp[n][i][j][k] print("{:.8f}".format(float(ans / 6 ** n))) if __name__ == "__main__": main()
Submission Info
Submission Time | |
---|---|
Task | D - サイコロ |
User | reiyw |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 1384 Byte |
Status | TLE |
Exec Time | 2108 ms |
Memory | 16780 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 4 | ||||
Status |
|
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 | TLE | 2108 ms | 15500 KB |
01 | TLE | 2108 ms | 15116 KB |
02 | TLE | 2108 ms | 14348 KB |
03 | TLE | 2108 ms | 14092 KB |
04 | TLE | 2108 ms | 14092 KB |
05 | TLE | 2108 ms | 14092 KB |
06 | TLE | 2108 ms | 16780 KB |
07 | TLE | 2108 ms | 14092 KB |
08 | TLE | 2108 ms | 14476 KB |
09 | TLE | 2108 ms | 14476 KB |
10 | AC | 147 ms | 12060 KB |
90 | AC | 1893 ms | 14860 KB |
91 | TLE | 2108 ms | 15244 KB |