0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

paizaラーニング問題集「3項間漸化式1」を解いてみた

Posted at

▼感想:

前の問題である 特殊な2項間漸化式1,2 を踏まえて
比較的簡単にコードを書くことができました。

▼コード:

########## 処理0(準備) インプット,リスト定義など ###########

k = int(input())

########## 処理1 漸化式の定義、計算、出力 ##########

a = [1]*(40+1)

for i in range(3,40+1):
    
    a[i] = a[i-1] + a[i-2]

print(a[k])
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?