結果

問題 No.53 悪の漸化式
ユーザー nanasili
提出日時 2014-10-30 23:54:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 697 bytes
コンパイル時間 930 ms
コンパイル使用メモリ 79,736 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-30 14:46:57
合計ジャッジ時間 1,553 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <string>
#include <cstring>

using namespace std;

typedef long long ll;

bool memo[101];
double x[101];
double rec(int n) {
  if (memo[n]) return x[n];
  memo[n] = true;
  return x[n]=(19*rec(n-1)-12*rec(n-2))/4 < 1e-10 ? 0 : (19*rec(n-1)-12*rec(n-2))/4;
}

int main() {
  x[0] = 4; x[1] = 3;
  memo[0] = true; memo[1] = true;
  
  int n;
  cin >> n;
  double t = rec(n);
  printf("%.10f\n", t);
}
0