結果
問題 |
No.574 正多面体サイコロ
|
ユーザー |
![]() |
提出日時 | 2019-06-15 01:44:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 424 bytes |
コンパイル時間 | 920 ms |
コンパイル使用メモリ | 76,844 KB |
最終ジャッジ日時 | 2025-01-07 04:41:46 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <iostream> #include <cmath> using namespace std; int f,n,k; double solve(int a,int b){ double F = f,I = a,N = n,ret; ret = pow((F - I)/F,b)*pow(I/F,n - b); for(int j=0;j<b;j++){ double J = j; ret *= (N - J)/(J + 1); } return ret; } int main(){ cout.precision(20); int i,j; cin >> f >> n >> k; double ans = 0; for(i=0;i<f;i++){ for(j=k;j<=n;j++){ ans += solve(i,j); } } cout << ans << endl; }