結果

問題 No.1076 寿司打
ユーザー warm4C0
提出日時 2023-05-07 21:37:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 1,212 ms
コンパイル使用メモリ 158,412 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-24 20:24:39
合計ジャッジ時間 1,941 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define EPS (1e-9)

using namespace std;

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

	double ans = 0;
	double i = 1, q = p;
	while(i*q > EPS) {
		ans += i*q;
		i += 1;
		q *= p;
	}
	ans *= (1-p);

	cout << fixed << setprecision(20) << ans << endl;

	return 0;
}
0