結果

問題 No.75 回数の期待値の問題
ユーザー Bantako
提出日時 2017-08-08 23:38:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 381 bytes
コンパイル時間 1,483 ms
コンパイル使用メモリ 165,764 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 00:18:35
合計ジャッジ時間 2,874 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 < 1000000){
        int num = 0;
        while(num != K){
            num += rand() % 6 + 1;
            if(num > K)num = 0;
            sum++;
        }
        cnt++;
    }
    cout << 1.* sum / cnt << endl;
}
0