結果
| 問題 |
No.44 DPなすごろく
|
| ユーザー |
|
| 提出日時 | 2018-09-02 10:37:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 439 bytes |
| コンパイル時間 | 545 ms |
| コンパイル使用メモリ | 72,896 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 17:25:39 |
| 合計ジャッジ時間 | 1,239 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
int ceil(int a, int b){
if (a % b){
return a/b + 1;
}else
return a/b;
}
int main(){
int n;
cin >> n;
long long dp[51];
dp[0] = 0;
dp[1] = 1;
dp[2] = 2;
for(int i = 3; i< 51; i++){
dp[i] = dp[i-1] + dp[i-2];
}
cout << dp[n] << endl;
}