結果
問題 | No.1807 UMA Gacha |
ユーザー | Digwee_kkkn |
提出日時 | 2022-01-14 21:48:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,002 bytes |
コンパイル時間 | 1,509 ms |
コンパイル使用メモリ | 168,752 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-20 09:20:44 |
合計ジャッジ時間 | 2,325 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include<bits/stdc++.h> #define _USE_MATH_DEFINES using namespace std; typedef long long ll; typedef float fl; typedef double db; typedef bool bl; typedef string st; typedef pair<int,int> P; typedef int itn; const int INF=100000000; const ll INFx=1000000000000; ll MOD=1000000007; int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1}; int DX[8]={0,-1,-1,-1,0,1,1,1} , DY[8]={1,1,0,-1,-1,-1,0,1}; string fi="01234567890123456789"; string al="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"; string AL="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"; int factorial(int i){return i ? factorial(i-1)*i:1;}; #define rep(i,n) for(int i=0;i<(n);++i) #define YesNo(flag) if(flag){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} int main(){ int n;cin>>n; fl p; cin>>p; if(n>=200){cout<<1;return 0;} fl v=0,ans=p; rep(i,n-1){ v=(1-ans)*p; ans+=v; v=0; } cout<<fixed<<setprecision(6)<<ans<<endl; }