結果

問題 No.53 悪の漸化式
ユーザー kk
提出日時 2021-04-19 04:34:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 252 ms / 5,000 ms
コード長 329 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 91,636 KB
最終ジャッジ日時 2023-09-17 08:13:24
合計ジャッジ時間 6,463 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 243 ms
91,392 KB
testcase_01 AC 243 ms
91,508 KB
testcase_02 AC 248 ms
91,628 KB
testcase_03 AC 251 ms
91,468 KB
testcase_04 AC 246 ms
91,304 KB
testcase_05 AC 242 ms
91,492 KB
testcase_06 AC 247 ms
91,540 KB
testcase_07 AC 247 ms
91,532 KB
testcase_08 AC 249 ms
91,444 KB
testcase_09 AC 249 ms
91,512 KB
testcase_10 AC 252 ms
91,508 KB
testcase_11 AC 252 ms
91,528 KB
testcase_12 AC 247 ms
91,636 KB
testcase_13 AC 247 ms
91,340 KB
testcase_14 AC 250 ms
91,472 KB
testcase_15 AC 247 ms
91,576 KB
testcase_16 AC 247 ms
91,368 KB
testcase_17 AC 249 ms
91,576 KB
testcase_18 AC 248 ms
91,492 KB
testcase_19 AC 246 ms
91,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import *

def main():
  getcontext().prec = 100
  
  n = int(input())
  a = [0 for _ in range(101)]
  
  a[0] = Decimal(4)
  a[1] = Decimal(3)

  for i in range(2, 101):
    a[i] = (Decimal(19) * a[i-1] - Decimal(12) * a[i-2]) / Decimal(4)

  print("{:.20f}".format(a[n]))
  

if __name__ == '__main__':
  main()
  
0