結果

問題 No.574 正多面体サイコロ
ユーザー chocoruskchocorusk
提出日時 2019-07-19 23:53:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,212 bytes
コンパイル時間 829 ms
コンパイル使用メモリ 94,836 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 00:49:39
合計ジャッジ時間 2,087 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int f, n, k;
    cin>>f>>n>>k;
    double p[110];
    p[f+1]=0;
    for(int i=1; i<=f; i++){
        p[i]=0;
        double c=1;
        for(int j=1; j<k; j++){
            c*=(double)(n-j+1);
            c/=(double)j;
        }
        for(int j=k; j<=n; j++){
            c*=(double)(n-j+1);
            c/=(double)j;
            double a=c;
            for(int l=0; l<j; l++){
                a*=(double)(f-i+1);
                a/=(double)f;
            }
            for(int l=0; l<n-j; l++){
                a*=(double)(i-1);
                a/=(double)f;
            }
            p[i]+=a;
        }
    }
    double ans=0;
    for(int i=1; i<=f; i++){
        ans+=(double)i*(p[i]-p[i+1]);
    }
    printf("%.7lf\n", ans);
    return 0;
}
0