結果
| 問題 |
No.574 正多面体サイコロ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-24 20:33:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 701 bytes |
| コンパイル時間 | 1,917 ms |
| コンパイル使用メモリ | 195,380 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-24 20:33:20 |
| 合計ジャッジ時間 | 3,386 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1010;
int f,n,k;
double ans;
signed main(){
//freopen("dice.in","r",stdin);
//freopen("dice.out","w",stdout);
cin>>f>>n>>k;
for(int x=1;x<=f;x++){
double p1=1.0*(f-x)/f,p2=1.0/f;
double p3=1.0-p1-p2;
double s=0.0;
for(int i=0;i<k;i++){
for(int j=k-i;j<=n-i;j++){
int t=n-i-j;
double p=1.0;
for(int l=1;l<=i;l++)p*=p1;
for(int l=1;l<=j;l++)p*=p2;
for(int l=1;l<=t;l++)p*=p3;
for(int l=1;l<=n;l++)p*=l;
for(int l=1;l<=i;l++)p/=l;
for(int l=1;l<=j;l++)p/=l;
for(int l=1;l<=t;l++)p/=l;
s+=p;
}
}
ans+=s*x;
}
cout<<fixed<<setprecision(15)<<ans<<'\n';
return 0;
}