結果

問題 No.65 回数の期待値の練習
ユーザー DadarithmDadarithm
提出日時 2015-10-11 11:19:35
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 280 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 53,844 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-21 06:23:08
合計ジャッジ時間 2,421 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

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