結果
問題 |
No.44 DPなすごろく
|
ユーザー |
![]() |
提出日時 | 2019-03-17 17:37:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 573 bytes |
コンパイル時間 | 1,520 ms |
コンパイル使用メモリ | 167,480 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 05:03:28 |
合計ジャッジ時間 | 2,403 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> #define be(v) (v).begin(),(v).end() #define pb(q) push_back(q) #define era(t) t.erase(unique(be(t)),t.end()) #define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl; typedef long long ll; using namespace std; const ll mod=1000000007,mod9=1000000009; template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));} int main() { cin.tie(0); ios::sync_with_stdio(false); ll n; cin>>n; ll dp[n+1]; dp[0]=dp[1]=1; for(int i=2;i<=n;i++){ dp[i]=dp[i-1]+dp[i-2]; } cout << dp[n]<<endl; return 0; }