結果
問題 | No.574 正多面体サイコロ |
ユーザー |
|
提出日時 | 2017-10-09 06:46:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 452 bytes |
コンパイル時間 | 832 ms |
コンパイル使用メモリ | 67,956 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-01-27 17:06:33 |
合計ジャッジ時間 | 4,018 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 20 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 6 | main() | ^~~~ main.cpp: In function ‘int main()’: main.cpp:9:37: warning: iteration 99 invokes undefined behavior [-Waggressive-loop-optimizations] 9 | for(int i=0;i++<100;)fact[i]=fact[i-1]*i; | ~~~~~~~^~~~~~~~~~~~ main.cpp:9:24: note: within this loop 9 | for(int i=0;i++<100;)fact[i]=fact[i-1]*i; | ~~~^~~~
ソースコード
#include<iostream>#include<iomanip>using namespace std;double fact[100]={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;}