結果
| 問題 | No.44 DPなすごろく |
| ユーザー |
TAISA_
|
| 提出日時 | 2018-06-11 12:58:01 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 439 bytes |
| 記録 | |
| コンパイル時間 | 968 ms |
| コンパイル使用メモリ | 174,728 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2026-03-20 13:58:43 |
| 合計ジャッジ時間 | 1,777 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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_