結果
問題 |
No.44 DPなすごろく
|
ユーザー |
![]() |
提出日時 | 2017-01-21 00:28:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 395 bytes |
コンパイル時間 | 1,897 ms |
コンパイル使用メモリ | 157,140 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 04:06:09 |
合計ジャッジ時間 | 2,700 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ull = unsigned long long int; #define en '\n'; const int mod=1000000007; int main(){ cin.tie(); ios::sync_with_stdio(false); ll dp[51]; fill_n(dp,51,0); dp[0]=1; for(int i=0;i<51;i++){ if(i<50){ dp[i+1]+=dp[i]; if(i<49) dp[i+2]+=dp[i]; } } int i; cin>>i; cout<<dp[i]<<en; return 0; }