結果
| 問題 |
No.44 DPなすごろく
|
| ユーザー |
TAISA_
|
| 提出日時 | 2018-06-11 12:58:01 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 439 bytes |
| コンパイル時間 | 1,240 ms |
| コンパイル使用メモリ | 158,708 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-30 13:30:38 |
| 合計ジャッジ時間 | 2,179 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const ll MOD=10000;
const ll INF=1000000010;
const int MAX=100001;
int dx[8]={0,1,0,-1,1,-1,1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
ll dp[60];
int main(){
int n;cin>>n;
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;
return 0;
}
TAISA_