結果

問題 No.108 トリプルカードコンプ
ユーザー takakintakakin
提出日時 2020-07-09 23:37:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 25,088 KB
最終ジャッジ日時 2024-04-17 05:37:57
合計ジャッジ時間 6,299 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 32 ms
10,624 KB
testcase_02 AC 33 ms
10,752 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 29 ms
10,624 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 29 ms
10,752 KB
testcase_07 WA -
testcase_08 AC 471 ms
24,960 KB
testcase_09 AC 497 ms
25,088 KB
testcase_10 AC 476 ms
24,960 KB
testcase_11 AC 458 ms
24,960 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
DP=[[[0]*(n+1) for i in range(n+1)] for j in range(n+1)]
for i in range(n+1):
  for j in range(n+1):
    for k in range(n+1):
      if i==0 and j==0 and k==0:
        continue
      elif i+j+k>n:
        continue  
      else:
        DP[i][j][k]+=1
        if i>0:
          DP[i][j][k]+=i/n*DP[i-1][+1][k]
        if j>0:
          DP[i][j][k]+=j/n*DP[i][j-1][k+1]
        if k>0:
          DP[i][j][k]+=k/n*DP[i][j][k-1]
        DP[i][j][k]*=n/(i+j+k)
C=[0]*3
for a in A:
  if a<3:
    C[a]+=1
c1,c2,c3=C
print(DP[c1][c2][c3])
        
0