結果
問題 | No.173 カードゲーム(Medium) |
ユーザー |
![]() |
提出日時 | 2015-04-11 09:09:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 596 ms / 3,000 ms |
コード長 | 874 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 78,724 KB |
最終ジャッジ日時 | 2024-07-04 13:38:32 |
合計ジャッジ時間 | 4,678 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#!/c/Python34/python# coding: utf-8import randomdef simulate(n, pa, pb, A, B):a = b = 0a += 1for _ in range(n):ra, rb = random.random(), random.random()i, j = -1, -1if ra > pa and len(A) > 1:i = random.randrange(len(A)-1)if rb > pb and len(B) > 1:j = random.randrange(len(B)-1)if A[i] > B[j]:a += A[i] + B[j]else:b += A[i] + B[j]del A[i], B[j]return a > bdef main():[n, pa, pb] = map(float, input().split())n = int(n)A = sorted(list(map(int, input().split())), reverse=True)B = sorted(list(map(int, input().split())), reverse=True)win, check = 0, 100000for _ in range(check):if simulate(n, pa, pb, A[:], B[:]):win += 1print(win/check)if __name__ == '__main__':main()