結果
| 問題 |
No.302 サイコロで確率問題 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-03 14:20:10 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 650 bytes |
| コンパイル時間 | 7,009 ms |
| コンパイル使用メモリ | 193,060 KB |
| 最終ジャッジ日時 | 2025-01-14 04:08:49 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 RE * 2 MLE * 3 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
long double dp[2000][12010],ans;
long long N,L,R;
main()
{
cin>>N>>L>>R;
if(N<2000){
dp[0][0]=1;
for(int t=0;t<N;++t){
for(int i=0;i<N*6;++i){
for(int k=1;k<=6;++k){
dp[t+1][i+k]+=dp[t][i]/6.;
}
}
}
for(int i=L;i<=R;++i)ans+=dp[N][i];
} else {
long double E=(1+2+3+4+5+6)/6.;
long double V=(1*1+2*2+3*3+4*4+5*5+6*6)/6.-E*E;
E*=N;
V*=N;
ans=(erf((R+.5-E)/(sqrt(2*V)))-erf((L-.5-E)/(sqrt(2*V))))*.5;
}
cout<<setprecision(20)<<ans<<endl;
}