結果

問題 No.1835 Generalized Monty Hall Problem
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-02-12 10:14:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 1,000 ms
コード長 264 bytes
コンパイル時間 1,202 ms
コンパイル使用メモリ 86,784 KB
実行使用メモリ 71,632 KB
最終ジャッジ日時 2023-09-10 21:00:01
合計ジャッジ時間 2,346 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,428 KB
testcase_01 AC 72 ms
71,360 KB
testcase_02 AC 71 ms
71,588 KB
testcase_03 AC 71 ms
71,352 KB
testcase_04 AC 70 ms
71,476 KB
testcase_05 AC 72 ms
71,524 KB
testcase_06 AC 73 ms
71,632 KB
testcase_07 AC 74 ms
71,500 KB
testcase_08 AC 74 ms
71,524 KB
testcase_09 AC 72 ms
71,576 KB
testcase_10 AC 74 ms
71,556 KB
testcase_11 AC 71 ms
71,572 KB
testcase_12 AC 73 ms
71,228 KB
testcase_13 AC 72 ms
71,476 KB
testcase_14 AC 70 ms
71,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
n,m,k = map(int,input().split())

a = (n-m)
b = (n-k-1)
x = a*m
y = n*b
g = gcd(x,y)
x1 = x//g
y1 = y//g

a = m
b = (n-k-1)
x = a*(m-1)
y = n*b
g = gcd(x,y)
x2 = x//g
y2 = y//g

a = x1*y2+x2*y1
b = y1*y2
g = gcd(a,b)
a //= g
b //= g
print(a,b)
0