結果

問題 No.813 ユキちゃんの冒険
ユーザー sho_00sho_00
提出日時 2020-04-08 18:26:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 387 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,752 KB
実行使用メモリ 8,104 KB
最終ジャッジ日時 2023-09-26 07:22:03
合計ジャッジ時間 2,743 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,888 KB
testcase_01 WA -
testcase_02 AC 18 ms
8,072 KB
testcase_03 WA -
testcase_04 AC 17 ms
7,968 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 17 ms
8,104 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
n=int(input())
p=float(input())
q=float(input())
if p==1:
  print(1)
elif q==1:
  print(0)
else:
  N=min(int((-5-math.log10(p))/(math.log10(p)+math.log10(q)))+1,n)
  ans=0
  for i in range(N+1):
    if i==0:
      ans+=p
    elif i==1:
      ans+=p**2*q
    else:
      C=math.factorial(2*i+2)//math.factorial(i+1)//math.factorial(i+1)
      ans+=C*q**i*p**(i+1)
  print(ans)
0