結果

問題 No.2461 一点張り
ユーザー lloyzlloyz
提出日時 2023-09-08 21:41:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 632 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 77,420 KB
最終ジャッジ日時 2023-09-08 21:41:37
合計ジャッジ時間 2,377 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,344 KB
testcase_01 AC 97 ms
77,420 KB
testcase_02 AC 97 ms
77,296 KB
testcase_03 AC 101 ms
77,324 KB
testcase_04 AC 101 ms
77,192 KB
testcase_05 AC 99 ms
77,112 KB
testcase_06 AC 102 ms
77,224 KB
testcase_07 AC 105 ms
76,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    p, k = map(float, input().split())
    k = int(k)
    ans = 0
    temp = 1.0
    for i in range(1, k):
        ans += i * temp * p
        temp *= 1 - p
    ans += k * temp
    print(ans)
0