結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
4,348 KB
testcase_01 AC 1,549 ms
4,348 KB
testcase_02 RE -
testcase_03 AC 124 ms
4,348 KB
testcase_04 AC 1,541 ms
4,352 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 143 ms
4,480 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

long double probably(int n, int s, int l, int 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<=r;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("%.15Lf\n",probably(N,6,L,R));
	}else{
		return 1;
	}
}
0