結果
| 問題 | No.65 回数の期待値の練習 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-24 12:20:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 435 bytes |
| コンパイル時間 | 1,602 ms |
| コンパイル使用メモリ | 165,908 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-22 19:53:54 |
| 合計ジャッジ時間 | 2,696 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define REP(i,n) for(int i=0;i<int(n);i++)
double dp[25];
int main(void){
cin.tie(nullptr); ios_base::sync_with_stdio(false);
int i,j,k;
int K;
cin >> K;
for(i=1;i<=K;i++){
dp[i]=1.0;
for(j=1;j<=6;j++){
if(i-j<=0) continue;
dp[i]+=dp[i-j]/6;
}
}
cout << fixed << setprecision(12) << dp[K] << endl;
return 0;
}