結果
| 問題 | No.1688 Veterinarian |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2026-01-22 01:39:46 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 639 bytes |
| 記録 | |
| コンパイル時間 | 371 ms |
| コンパイル使用メモリ | 82,792 KB |
| 実行使用メモリ | 92,276 KB |
| 最終ジャッジ日時 | 2026-01-22 01:39:52 |
| 合計ジャッジ時間 | 5,836 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 TLE * 1 -- * 10 |
ソースコード
from math import comb
def f(a, b, c, n) -> float:
if n == 0: return 0
if a+b+c < 2: return 0
deno = comb(a+b+c, 2)
sp = 0
res = 0
if a >= 2:
p = comb(a, 2) / deno
res += p * (f(a-1, b, c, n-1) + 1)
sp += p
if b >= 2:
p = comb(b, 2) / deno
res += p * f(a, b-1, c, n-1)
sp += p
if c >= 2:
p = comb(c, 2) / deno
res += p * f(a, b, c-1, n-1)
sp += p
rest_p = 1 - sp
res += rest_p * f(a, b, c, n-1)
return res
A, B, C, N = map(int, input().split())
a = f(A, B, C, N)
b = f(B, A, C, N)
c = f(C, A, B, N)
print(a, b, c)
norioc