結果
問題 | No.302 サイコロで確率問題 (2) |
ユーザー |
![]() |
提出日時 | 2015-12-28 17:26:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 136 ms / 6,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 291 ms |
コンパイル使用メモリ | 40,524 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 14:41:22 |
合計ジャッジ時間 | 1,570 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
コンパイルメッセージ
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(long long i=L;i<=min(R,N*6);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); }