結果

問題 No.75 回数の期待値の問題
ユーザー Bantako
提出日時 2017-08-08 23:39:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 106 ms / 5,000 ms
コード長 381 bytes
コンパイル時間 1,488 ms
コンパイル使用メモリ 166,996 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 00:18:41
合計ジャッジ時間 4,481 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
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