138402025-01-08 21:05:56mateJárda-L (40)cpp17Accepted 40/401ms508 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector <int> dp(30);
	dp[0] = 0;
	dp[1] = 1;
	dp[2] = 2;
	dp[3] = 5;
	for(int i = 4; i <= 29; i++){
		dp[i] = dp[i-3] + 2 * dp[i-1];
	}
	cout << dp[n];
	
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms332 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms388 KiB
8Accepted3/31ms320 KiB
9Accepted3/31ms316 KiB
10Accepted3/31ms508 KiB
11Accepted3/31ms316 KiB
12Accepted3/31ms316 KiB
13Accepted3/31ms320 KiB
14Accepted3/31ms316 KiB
15Accepted3/31ms316 KiB
16Accepted3/31ms508 KiB
17Accepted3/31ms316 KiB