結果
問題 |
No.574 正多面体サイコロ
|
ユーザー |
|
提出日時 | 2025-09-18 21:52:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 2,000 ms |
コード長 | 1,633 bytes |
コンパイル時間 | 1,744 ms |
コンパイル使用メモリ | 195,380 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-18 21:52:10 |
合計ジャッジ時間 | 2,627 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include<bits/stdc++.h> #define int long long using namespace std; #define fi first #define sc second #define pii pair<int,int> #define pdd pair<double,double> #define pb push_back #define umap unordered_map #define mset multiset #define pq priority_queue #define ull unsigned long long #define i128 __int128 #define ld long double #define fixs fixed<<setprecision #define FileIn(x) freopen(x".in","r",stdin) #define FileOut(x) freopen(x".out","w",stdout) #define FileIO(x) FileIn(x),FileOut(x); const int maxn=300+10; int n,m,K; ld fr[maxn],res; void solve(){ cin>>n>>m>>K; // fr[0]=1; // for(int i=1;i<=m;i++) fr[i]=fr[i-1]*i; for(int i=1;i<=m;i++) fr[i]=fr[i-1]+log2(i); for(int i=1;i<=n;i++){ for(int j=0;j<=m;j++){ for(int k=0;k<=m;k++){ if(!(j+k<=m&&j<K&&j+k>=K)) continue; // res+=i*fr[m]*pow(n-i,j)*pow(i-1,m-j-k)/fr[j]/fr[k]/fr[m-j-k]/pow(n,m); ld x=log2(i)+fr[m]+(i<n?log2(n-i)*j:0)+(i>1?log2(i-1)*(m-j-k):0)-fr[j]-fr[k]-fr[m-j-k]-log2(n)*m; // cout<<i<<" "<<j<<" "<<k<<" "<<pow(i-1,m-j-k)<<endl; // cout<<i*fr[m]*pow(n-i,j)*pow(i-1,m-j-k)/fr[j]/fr[k]/fr[m-j-k]/pow(n,m)<<endl; if((i==n&&j!=0)||(i==1&&j+k!=m)) continue; res+=pow(2,x); } } } cout<<fixs(10)<<res<<endl; } signed main(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); int t=1; // cin>>t; while(t--) solve(); return 0; } /* Samples input: output: THINGS TODO: 检查freopen,尤其是后缀名 检查空间 检查调试语句是否全部注释 */