結果

問題 No.58 イカサマなサイコロ
ユーザー Lay_ecLay_ec
提出日時 2014-11-05 00:18:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 547 ms / 5,000 ms
コード長 628 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 71,332 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-29 00:39:47
合計ジャッジ時間 4,123 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
4,376 KB
testcase_01 AC 547 ms
4,380 KB
testcase_02 AC 107 ms
4,380 KB
testcase_03 AC 57 ms
4,380 KB
testcase_04 AC 305 ms
4,380 KB
testcase_05 AC 353 ms
4,376 KB
testcase_06 AC 476 ms
4,376 KB
testcase_07 AC 106 ms
4,380 KB
testcase_08 AC 207 ms
4,376 KB
testcase_09 AC 474 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>

using namespace std; 


int main(){

	int n,k;
	cin>>n>>k;
	
	srand(time(NULL));

	long win=0;
	for(long i=0;i<(2<<20);i++){
		int jiro=0,taro=0;
		for(int j=0;j<n;j++) jiro+=(rand()%6+1);
		for(int j=0;j<n-k;j++) taro+=(rand()%6+1);
		for(int j=0;j<k;j++) taro+=(rand()%3+4);

		if(taro>jiro) win++;
	}

	printf("%.16f\n",(double)win/(2<<20));

	return 0;
}
0