結果

問題 No.574 正多面体サイコロ
ユーザー vjudge1
提出日時 2025-10-15 17:28:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 1,445 ms
コンパイル使用メモリ 163,272 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-15 17:28:39
合計ジャッジ時間 2,743 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    double f, fac[105];
    cin >> f >> n >> k;
    fac[0] = 1;
    for(int i = 1; i < 105; i++) fac[i] = fac[i - 1] * i;
    double ans = 0;
    for(int i = 1; i <= f; i++){
        double sum = 0;
        double A = (i - 1) / f;
        double B = 1 / f;
        double C = (f - i) / f;
        for(int x = 0; x < n - k + 1; x++)
            for(int y = 0; y < k; y++)
                sum += pow(A, x) * pow(B, n - x - y) * pow(C, y) * (fac[n] / fac[x] / fac[y] / fac[n - x - y]);
        ans += i * sum;
    }
    printf("%.7f\n", ans);
    return 0;
}
0