結果

問題 No.65 回数の期待値の練習
ユーザー DadarithmDadarithm
提出日時 2015-10-11 11:19:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 85 ms / 5,000 ms
コード長 280 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 51,488 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-28 11:42:51
合計ジャッジ時間 2,482 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
4,380 KB
testcase_01 AC 18 ms
4,376 KB
testcase_02 AC 24 ms
4,376 KB
testcase_03 AC 40 ms
4,376 KB
testcase_04 AC 29 ms
4,376 KB
testcase_05 AC 31 ms
4,380 KB
testcase_06 AC 35 ms
4,376 KB
testcase_07 AC 43 ms
4,380 KB
testcase_08 AC 46 ms
4,376 KB
testcase_09 AC 50 ms
4,380 KB
testcase_10 AC 53 ms
4,376 KB
testcase_11 AC 57 ms
4,380 KB
testcase_12 AC 60 ms
4,376 KB
testcase_13 AC 64 ms
4,380 KB
testcase_14 AC 67 ms
4,380 KB
testcase_15 AC 71 ms
4,380 KB
testcase_16 AC 74 ms
4,380 KB
testcase_17 AC 78 ms
4,380 KB
testcase_18 AC 82 ms
4,380 KB
testcase_19 AC 85 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
	int K;
	cin >> K;

	int tmp = 0, a = 0, b = 0;
	while (b <= 1000000)
	{
		tmp += rand() % 6 + 1;
		++a;
		if (K <= tmp)
		{
			++b;
			tmp = 0;
		}
	}

	cout << (double)a / (double)b << endl;

	return 0;
}
0