結果

問題 No.2461 一点張り
ユーザー FromBooskaFromBooska
提出日時 2023-09-08 22:39:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 1,618 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 77,448 KB
最終ジャッジ日時 2023-09-08 22:39:22
合計ジャッジ時間 2,152 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,212 KB
testcase_01 AC 106 ms
77,448 KB
testcase_02 AC 107 ms
77,224 KB
testcase_03 AC 112 ms
77,232 KB
testcase_04 AC 113 ms
77,396 KB
testcase_05 AC 107 ms
77,132 KB
testcase_06 AC 139 ms
77,256 KB
testcase_07 AC 112 ms
76,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for t in range(T):
    p, K = map(float, input().split())
    K = int(K)
    prob = [0]*(K+1)
    cumu = 0
    for i in range(1, K+1):
        if i == K:
            prob[i] = 1-cumu
        else:
            prob[i] = (1-cumu)*p
        cumu += prob[i]
    EV = 0
    for i in range(1, K+1):
        EV += i*prob[i]

    #print(prob)
    print(EV)
0