結果

問題 No.786 京都大学の過去問
ユーザー chocoruskchocorusk
提出日時 2019-02-08 21:34:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 91,812 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 04:03:21
合計ジャッジ時間 1,215 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n; cin>>n;
	ll dp[2][51]={};
	dp[0][0]=dp[1][1]=1;
	for(int i=1; i<n; i++){
		if(i>1) dp[1][i]+=dp[0][i-2];
		dp[0][i]+=dp[1][i-1];
		dp[0][i]+=dp[0][i-1];
	}
	cout<<dp[0][n-1]+dp[1][n-1]<<endl;
	return 0;
}
0