結果
問題 |
No.567 コンプリート
|
ユーザー |
|
提出日時 | 2019-04-07 08:59:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 511 ms / 2,000 ms |
コード長 | 747 bytes |
コンパイル時間 | 678 ms |
コンパイル使用メモリ | 73,040 KB |
最終ジャッジ日時 | 2025-01-07 01:27:28 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 |
ソースコード
#include <iostream> #include <iomanip> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; struct before_main_function { before_main_function() { cout<<setprecision(20)<<fixed; } } before_main_function; // ========== end of template ========== constexpr int N_MAX = 1e6; constexpr int KINDS = 6; // [i][k] // i番目までで (0-indexed), k種類揃っている確率 double dp[N_MAX+1][KINDS+1] = {0.0}; int main(int argc, char** argv) { int N; cin >> N; dp[0][0] = 1.0; for (int i=1; i<=N; i++) { for (int k=1; k<=KINDS; k++) { dp[i][k] = dp[i-1][k]*double(k)/6.0 + dp[i-1][k-1]*double(6-(k-1))/6.0; } } cout << dp[N][6] << endl; return 0; }