結果
| 問題 |
No.1807 UMA Gacha
|
| コンテスト | |
| ユーザー |
koryou
|
| 提出日時 | 2022-01-14 21:36:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,085 bytes |
| コンパイル時間 | 1,084 ms |
| コンパイル使用メモリ | 92,552 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-20 08:28:31 |
| 合計ジャッジ時間 | 1,673 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <string>
#include <list>
#include <cassert>
#include <numeric>
#include <cstdint>
#include <queue>
#include <deque>
#include <stack>
#include <set>
// #include <atcoder/all>
using ll = long long;
using ld = long double;
using namespace std;
// using namespace atcoder;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using Priority = priority_queue<ll, vector<ll>, greater<ll>>;// 昇順
using Priority_pair = priority_queue<P, vector<P>, greater<P>>;
// using mint_17 = modint1000000007;
// using mint = modint998244353;
// typedef pair<int,int> P;
#define mod 1000000007
#define MAX_WIDTH 60
#define MAX_HEIGHT 60
#define INF 1e18
#define MOD 998244353
#define PI 3.141592653589793
ll N;
double p;
int main(){
cin >> N >> p;
if(N >= 200) {
cout << 1 << endl;
} else {
double ans = p;
for(int i=1;i<N;i++) {
ans += p * powl((1 - p),i);
}
printf("%.9lf\n", ans);
}
return 0;
}
koryou