結果

問題 No.302 サイコロで確率問題 (2)
コンテスト
ユーザー ciel
提出日時 2015-11-14 12:06:05
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 496 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 300 ms
コンパイル使用メモリ 66,688 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-04 06:29:23
合計ジャッジ時間 2,326 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge5_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 17 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

double probably(int n, int s, int l, int r){
	vector<double> a(s*(n+1)+1);
	for(int i=1;i<=s;i++)a[i+s]=pow(1.0/s,n);
	for(int e=0;e<n-1;e++)for(int i=s*n;i>=0;i--){
		double sum=0;
		for(int j=i;j<i+s;j++)sum+=a[j];
		a[i+s]=sum;
	}
	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("%.15f\n",probably(N,6,L,R));
	}else{
	}
}
0