結果

問題 No.65 回数の期待値の練習
ユーザー kongarishisyamo
提出日時 2016-05-13 12:12:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 269 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 56,108 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-05 14:16:14
合計ジャッジ時間 2,798 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdlib>
#include<ctime>

using namespace std;

#define NUM 1000000

int main(){

	int K;
	int c=NUM;
	long long sum=0;
	
	cin>>K;

	while(c--){
		int xi=0;
		while(xi<K){
			sum+=1;
			xi+=rand()%6+1;
		}
	}

	cout<<(double)sum/NUM<<endl;
}
0