結果

問題 No.1807 UMA Gacha
ユーザー MasKoaTS
提出日時 2024-11-30 16:03:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 1,872 ms
コンパイル使用メモリ 193,084 KB
最終ジャッジ日時 2025-02-26 09:39:56
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

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


int main(){
    int n;  cin >> n;
    double p;   cin >> p;

    if(n >= 200){
        cout << 1 << endl;
        return 0;
    }

    double ans = 0, q = 1.0;
    for(int i = 0; i < n; ++i){
        ans += q * p;
        q *= 1 - p;
    }
    cout << setprecision(16) << ans << endl;

    return 0;
}
0