結果
問題 |
No.574 正多面体サイコロ
|
ユーザー |
|
提出日時 | 2020-02-07 07:20:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 640 ms |
コンパイル使用メモリ | 72,040 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 07:11:45 |
合計ジャッジ時間 | 1,644 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> #include<iomanip> using namespace std; double fact[101]={1},ans;int f,n,k; double pow(double a,int b){return b?pow(a*a,b/2)*(b%2?a:1):1;} main() { cin>>f>>n>>k; for(int i=0;i++<100;)fact[i]=fact[i-1]*i; for(int i=1;i<=f;i++) { for(int j=0;j<k;j++) { for(int l=k-j;j+l<=n;l++) { ans+=i*(fact[n]/fact[j]/fact[l]/fact[n-j-l])*pow(f-i,j)*pow(i-1,n-j-l)/pow(f,n); } } } cout<<fixed<<setprecision(15)<<ans<<endl; }