結果

問題 No.75 回数の期待値の問題
ユーザー BantakoBantako
提出日時 2017-08-08 23:39:20
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 106 ms / 5,000 ms
コード長 381 bytes
コンパイル時間 1,656 ms
コンパイル使用メモリ 162,436 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 05:18:30
合計ジャッジ時間 4,250 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
5,248 KB
testcase_01 AC 100 ms
5,376 KB
testcase_02 AC 106 ms
5,376 KB
testcase_03 AC 101 ms
5,376 KB
testcase_04 AC 104 ms
5,376 KB
testcase_05 AC 104 ms
5,376 KB
testcase_06 AC 104 ms
5,376 KB
testcase_07 AC 99 ms
5,376 KB
testcase_08 AC 103 ms
5,376 KB
testcase_09 AC 99 ms
5,376 KB
testcase_10 AC 100 ms
5,376 KB
testcase_11 AC 102 ms
5,376 KB
testcase_12 AC 101 ms
5,376 KB
testcase_13 AC 101 ms
5,376 KB
testcase_14 AC 102 ms
5,376 KB
testcase_15 AC 101 ms
5,376 KB
testcase_16 AC 103 ms
5,376 KB
testcase_17 AC 98 ms
5,376 KB
testcase_18 AC 99 ms
5,376 KB
testcase_19 AC 103 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
main(){
    int K;
    ll sum = 0,cnt = 0;
    cin >> K;
    while(sum < 5000000){
        int num = 0;
        while(num != K){
            num += rand() % 6 + 1;
            if(num > K)num = 0;
            sum++;
        }
        cnt++;
    }
    cout << 1.* sum / cnt << endl;
}
0