結果

問題 No.65 回数の期待値の練習
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-05-13 12:12:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 269 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 54,752 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 15:28:36
合計ジャッジ時間 2,992 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
6,812 KB
testcase_01 AC 26 ms
6,940 KB
testcase_02 AC 30 ms
6,944 KB
testcase_03 AC 53 ms
6,940 KB
testcase_04 AC 35 ms
6,944 KB
testcase_05 AC 40 ms
6,940 KB
testcase_06 AC 46 ms
6,944 KB
testcase_07 AC 59 ms
6,944 KB
testcase_08 AC 63 ms
6,940 KB
testcase_09 AC 69 ms
6,940 KB
testcase_10 AC 75 ms
6,940 KB
testcase_11 AC 82 ms
6,944 KB
testcase_12 AC 88 ms
6,940 KB
testcase_13 AC 93 ms
6,944 KB
testcase_14 AC 99 ms
6,940 KB
testcase_15 AC 104 ms
6,940 KB
testcase_16 AC 110 ms
6,940 KB
testcase_17 AC 116 ms
6,944 KB
testcase_18 AC 122 ms
6,940 KB
testcase_19 AC 129 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

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