結果
| 問題 |
No.567 コンプリート
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2017-09-14 19:10:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 926 bytes |
| コンパイル時間 | 863 ms |
| コンパイル使用メモリ | 83,856 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-11-07 19:55:08 |
| 合計ジャッジ時間 | 4,300 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 11 TLE * 1 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 567.cc: No.567 コンプリート - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int D = 6;
const int DBITS = 1 << D;
/* typedef */
/* global variables */
double dp[2][DBITS];
/* subroutines */
/* main */
int main() {
int n;
cin >> n;
dp[0][0] = 1.0;
int cur = 0, nxt = 1;
for (int i = 0; i < n; i++) {
fill(dp[nxt], dp[nxt] + DBITS, 0);
for (int bits = 0; bits < DBITS; bits++)
for (int d = 0, bd = 1; d < D; d++, bd <<= 1)
dp[nxt][bits | bd] += dp[cur][bits] / D;
cur ^= 1, nxt ^= 1;
}
printf("%.8lf\n", dp[cur][DBITS - 1]);
}
tnakao0123