結果

問題 No.567 コンプリート
ユーザー tnakao0123tnakao0123
提出日時 2017-09-14 19:10:18
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 926 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 83,548 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-25 09:21:48
合計ジャッジ時間 4,253 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,448 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- 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]);
}
0