結果

問題 No.58 イカサマなサイコロ
ユーザー furafura
提出日時 2020-04-14 01:41:22
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2,045 ms / 5,000 ms
コード長 371 bytes
コンパイル時間 2,063 ms
コンパイル使用メモリ 202,932 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-04-08 15:17:04
合計ジャッジ時間 14,123 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 481 ms
6,548 KB
testcase_01 AC 2,045 ms
6,548 KB
testcase_02 AC 434 ms
6,548 KB
testcase_03 AC 268 ms
6,548 KB
testcase_04 AC 1,241 ms
6,548 KB
testcase_05 AC 1,421 ms
6,548 KB
testcase_06 AC 1,824 ms
6,548 KB
testcase_07 AC 485 ms
6,548 KB
testcase_08 AC 879 ms
6,548 KB
testcase_09 AC 1,806 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

random_device seed_gen;
mt19937 rng(seed_gen());

int main(){
	int n,k; scanf("%d%d",&n,&k);
	int cnt=0;
	rep(_,1e7){
		int sum=0;
		rep(i,n){
			sum+=rng()%6+1;
			if(i<k) sum-=rng()%3+4;
			else    sum-=rng()%6+1;
		}
		if(sum<0) cnt++;
	}
	printf("%.9f\n",cnt/1e7);
	return 0;
}
0