結果

問題 No.2461 一点張り
ユーザー titiatitia
提出日時 2023-09-08 21:30:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 297 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 10,488 KB
実行使用メモリ 7,872 KB
最終ジャッジ日時 2023-09-08 21:30:53
合計ジャッジ時間 1,689 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,872 KB
testcase_01 AC 111 ms
7,824 KB
testcase_02 AC 112 ms
7,816 KB
testcase_03 AC 212 ms
7,796 KB
testcase_04 AC 114 ms
7,800 KB
testcase_05 AC 156 ms
7,820 KB
testcase_06 AC 121 ms
7,828 KB
testcase_07 AC 21 ms
7,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T=int(input())
for tests in range(T):
    p,K=map(float,input().split())
    K=int(K)

    ANS=0
    now=1

    for i in range(K):
        if i!=K-1:
            ANS+=(i+1)*now*p
        else:
            ANS+=(i+1)*now
        now=now*(1-p)

    print(ANS)
0