結果
問題 | No.65 回数の期待値の練習 |
ユーザー | otsnsk |
提出日時 | 2014-12-27 10:20:22 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 565 ms |
コンパイル使用メモリ | 61,784 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 23:49:13 |
合計ジャッジ時間 | 1,456 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <iostream> #include <iomanip> #define FORR(i,b,e) for(int i=(b);i<(int)(e);++i) #define FOR(i,e) FORR(i,0,e) #define dump(var) cerr << #var ": " << var << "\n" #define dumpc(con) for(auto& e: con) cerr << e << " "; cerr<<"\n" typedef long long ll; typedef unsigned long long ull; using namespace std; double E[30]; int main() { cin.tie(0); ios::sync_with_stdio(false); int K; cin >> K; E[0] = 0; E[1] = 1; FORR(k, 2, K+1) { double e = 0; FORR(i, 1, 7) e += E[max(k-i, 0)]; E[k] = 1 + e/6; } cout << fixed << setprecision(5) << E[K] << endl; return 0; }