結果
問題 | No.574 正多面体サイコロ |
ユーザー |
![]() |
提出日時 | 2019-05-13 16:19:50 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 1,405 bytes |
コンパイル時間 | 1,017 ms |
コンパイル使用メモリ | 94,736 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 19:28:50 |
合計ジャッジ時間 | 2,331 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <string> #include <map> #include <set> #include <queue> #include <stack> #include <vector> #include <limits.h> #include <math.h> #include <functional> #include <bitset> #include <iomanip> #include <cassert> #include <float.h> #include <random> #define repeat(i,n) for (int i = 0; (i) < (n); ++ (i)) #define debug(x) cerr << #x << ": " << x << '\n' #define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n' #define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n' using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> Pii; typedef vector<int> vint; typedef vector<ll> vll; const ll INF = LLONG_MAX/10; const ll MOD = 1e9+7; int F,N,K; double ans=0; int main(){ cin.tie(0); ios::sync_with_stdio(false); cin>>F>>N>>K; for(int x=1;x<=F;x++){ double CC=1,C=1; repeat(i,N+1){ C=1; repeat(j,N-i+1){ int k=N-i-j; if(i<K&&K<=i+j)ans += (double)x*pow(double(F-x)/F,i)*pow(1./F,j)*pow((double)(x-1)/F,k)*CC*C; C *= (N-i-j); C /= (j+1); } //debug(CC); CC *= (N-i); CC /= (i+1); } } printf("%.10lf\n",ans); return 0; }