Skip to content

Instantly share code, notes, and snippets.

@niklasjang
Created April 16, 2020 01:11
Show Gist options
  • Save niklasjang/d1eaae420bbc34c20f0dc7d97eac3fbf to your computer and use it in GitHub Desktop.
Save niklasjang/d1eaae420bbc34c20f0dc7d97eac3fbf to your computer and use it in GitHub Desktop.
[PS][DP]/[BOJ][2193][이친수]
#include <iostream>
using namespace std;
int n = 0;
long long dp[91][2];
int main(void) {
int n = 0;
cin >> n;
dp[1][0] = 0;
dp[1][1] = 1;
for (int i = 2; i <= n; i++) {
dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
dp[i][1] = dp[i - 1][0];
}
cout << dp[n][0] + dp[n][1];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment