結果

問題 No.1076 寿司打
ユーザー DADATAKADADATAKA
提出日時 2020-06-12 21:34:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 656 bytes
コンパイル時間 2,695 ms
コンパイル使用メモリ 191,172 KB
最終ジャッジ日時 2025-01-11 02:18:49
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep_ll(i,n) for(ll i = 0; i < (ll)(n); i++)
using namespace std;
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
const long double PI = (acos(-1));
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1};
ll mod = 1000000007;
int main(){
    double p;
    cin >> p;
    double i=1;
    double pp=1;
    double ans = 0;
    //while(i*p>0.00001){
    while(i<100000){
        pp = pp * p;
        ans += pp * i * (1-p);
        i+=1.0;
    }
    cout << fixed << setprecision(5) << ans;
    return 0;
}
0