結果
問題 | No.786 京都大学の過去問 |
ユーザー |
![]() |
提出日時 | 2019-07-17 19:30:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 298 bytes |
コンパイル時間 | 1,609 ms |
コンパイル使用メモリ | 165,648 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 04:04:51 |
合計ジャッジ時間 | 2,230 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; signed main(){ ios::sync_with_stdio(false); cin.tie(0); ll n; cin>>n; ll dp[n+1]={}; dp[0]=1; for(int i=1;i<=n;i++){ dp[i]=dp[i-1]; if(i>1) dp[i]+=dp[i-2]; } cout<<dp[n]<<endl; }