結果

問題 No.58 イカサマなサイコロ
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-02-28 02:55:24
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 426 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 55,828 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2023-10-24 18:44:10
合計ジャッジ時間 10,177 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,602 ms
4,348 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstdlib>

using namespace std;

int main(){

	srand(2);

	int xi[]={1,2,3,4,5,6};
	int ixi[]={4,5,6,4,5,6};
	int N,K;
	int tw=0,zw=0;
	int i=0;

	cin>>N>>K;

	while(i<20000000){
		int tp=0,zp=0;
		for(int i=0;i<N;i++){
			if(i<K) tp+=ixi[rand()%6];
			else tp+=xi[rand()%6];
			zp+=xi[rand()%6];
		}
		if(tp>zp) tw++;
		else zw++;

		i++;
	}
	printf("%.3f\n",(double)tw/(tw+zw));
}
0