結果
| 問題 | No.567 コンプリート | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-08-25 17:31:14 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 496 ms / 2,000 ms | 
| コード長 | 472 bytes | 
| コンパイル時間 | 644 ms | 
| コンパイル使用メモリ | 69,760 KB | 
| 実行使用メモリ | 50,544 KB | 
| 最終ジャッジ日時 | 2024-06-26 08:19:12 | 
| 合計ジャッジ時間 | 2,096 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 12 | 
ソースコード
#include<iostream>
#include<iomanip>
using namespace std;
#define fcout(x) cout << fixed << setprecision(x)
int main(){
    int n;
    cin >> n;
    static double dp[1000001][6] = {};
    dp[1][0] = 1.0;
    for(int i = 2; i <= n; i++){
        for(int j = 0; j < 6; j++){
            if(j == 0)  dp[i][j] = dp[i-1][j]/6;
            else        dp[i][j] = dp[i-1][j-1]*(6-j)/6 + dp[i-1][j]*(j+1)/6;
        }
    }
    fcout(10) << dp[n][5] << endl;
    return 0;
}
            
            
            
        