結果

問題 No.2461 一点張り
ユーザー karinohito
提出日時 2023-09-22 14:48:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 370 bytes
コンパイル時間 1,837 ms
コンパイル使用メモリ 192,500 KB
最終ジャッジ日時 2025-02-17 00:03:56
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int T;
    cin>>T;
    while(T--){
        double P;
        int K;
        cin>>P>>K;
        double an=0;
        double p=1.0;
        for(int i=1;i<=K;i++){
            an+=p*P*double(i);
            p*=(1-P);
        }
        an+=p*double(K);
        cout<<fixed<<setprecision(15)<<an<<endl;
    }
}
0