結果
| 問題 |
No.302 サイコロで確率問題 (2)
|
| コンテスト | |
| ユーザー |
piyoko_212
|
| 提出日時 | 2015-12-28 17:24:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 634 bytes |
| コンパイル時間 | 342 ms |
| コンパイル使用メモリ | 40,396 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 07:36:22 |
| 合計ジャッジ時間 | 1,936 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 RE * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%lld%lld%lld",&N,&L,&R);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double dp[61000];
double EPS=1e-9;
int main(){
long long N,L,R;
scanf("%lld%lld%lld",&N,&L,&R);
if(N<=5000){
dp[0]=1;
for(int i=0;i<N;i++){
for(int j=i*6;j>=i;j--){
for(int k=1;k<=6;k++){
dp[j+k]+=dp[j]/6;
}
dp[j]=0;
}
}
double ret=0;
for(int i=L;i<=R;i++)ret+=dp[i];
printf("%.12f\n",ret);
return 0;
}
double sd=sqrt(17.5/6)*sqrt((double)N);
double ave=3.5*N;
double r=(R+0.5-ave)/(sqrt(2.0)*sd);
double l=(L-0.5-ave)/(sqrt(2.0)*sd);
//printf("%f %f %f %f\n",sd,ave,l,r);
printf("%.12f\n",(erf(r)-erf(l))/2);
}
piyoko_212