結果

問題 No.302 サイコロで確率問題 (2)
ユーザー cielciel
提出日時 2015-11-15 01:12:08
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 539 ms
コンパイル使用メモリ 48,492 KB
実行使用メモリ 5,056 KB
最終ジャッジ日時 2023-10-11 17:48:32
合計ジャッジ時間 5,470 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
4,372 KB
testcase_01 AC 1,667 ms
4,376 KB
testcase_02 AC 1 ms
4,372 KB
testcase_03 AC 133 ms
4,376 KB
testcase_04 AC 1,656 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,372 KB
testcase_07 AC 2 ms
4,372 KB
testcase_08 AC 152 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 201 ms
4,380 KB
testcase_12 AC 2 ms
4,504 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,372 KB
testcase_16 AC 4 ms
4,372 KB
testcase_17 AC 1 ms
4,372 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

long double probably(int n, int s, long long l, long long r){
	vector<long double> a(s*(n+1)+1);
	for(int i=1;i<=s;i++)a[i+s]=powl(1.0/s,n);
	for(int e=0;e<n-1;e++)for(int i=s*n;i>=0;i--){
		long double sum=0;
		for(int j=i;j<i+s;j++)sum+=a[j];
		a[i+s]=sum;
	}
	long double ret=0;
	for(;l<=min(r,(long long)a.size());l++)ret+=a[s+l];
	return ret;
}

int main(){
	long long N,L,R;
	scanf("%lld%lld%lld",&N,&L,&R);
	if(N<10000){
		printf("%.9Lf\n",probably(N,6,L,R));
	}else{
		double a=N*3.5,v=N*35.0/12,den=sqrt(2*v);
		printf("%.9f\n",( erf((R+0.5-a)/den)-erf((L-0.5-a)/den) )/2);
	}
}
0