結果

問題 No.1807 UMA Gacha
ユーザー harshith akkapelliharshith akkapelli
提出日時 2022-01-14 22:36:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 494 bytes
コンパイル時間 1,829 ms
コンパイル使用メモリ 166,596 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-20 12:49:12
合計ジャッジ時間 2,859 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 8 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long int ll;

void routine(){
	ll n;
	double p;
	cout << fixed << setprecision(7);
	cin >> n >> p;
	if(n >= 200){
		cout << 1;
		return;
	}
	double ans = 0;
	double start = 1.0;
	for(ll i = 0;i <= n;i++){
		ans += start*p;
		start *= (1-p);
	}
	cout << fixed << setprecision(7) << ans;
	return;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll t = 1;
	while(t--){
		routine();
	}
	return 0;
}
0