71382023-12-31 12:40:30xxxJárda-L (40)cpp17Accepted 40/403ms4160 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int n;
	cin >> n;
	vector<int> dp(n+1);
	dp[0] = dp[1] = 1;
	dp[2] = 2;
	for(int i = 3; i <= n; i++) {
        dp[i] = dp[i-1] * 2 + dp[i-3];
	}

	cout << dp[n] << '\n';


	return 0;
}

SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1824 KiB
2Accepted0/03ms2064 KiB
3Accepted2/23ms2232 KiB
4Accepted2/23ms2464 KiB
5Accepted2/23ms2564 KiB
6Accepted2/23ms2732 KiB
7Accepted2/23ms2940 KiB
8Accepted3/33ms3148 KiB
9Accepted3/33ms3236 KiB
10Accepted3/33ms3236 KiB
11Accepted3/33ms3492 KiB
12Accepted3/33ms3716 KiB
13Accepted3/33ms3604 KiB
14Accepted3/33ms3836 KiB
15Accepted3/33ms3824 KiB
16Accepted3/33ms3948 KiB
17Accepted3/33ms4160 KiB