結果

問題 No.44 DPなすごろく
ユーザー Nagisa
提出日時 2016-02-15 14:42:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 245 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 54,456 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-22 07:07:13
合計ジャッジ時間 1,424 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 19 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main()
{   int n;
	long long dp1, dp2, temp;
	cin >> n;
	dp1 = 1;
	dp2 = 2;
	for (int i = 2; i < n; i++) {
		temp = dp1 + dp2;
		dp1 = dp2;
		dp2 = temp;
	}
    cout << temp << endl;
    return 0;
}
0