29272023-02-04 14:59:53horvathabelJárda-L (40)cpp17Accepted 40/403ms3664 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	vector<int> dp={1,1,2};
	int cnt=0; 
	for (int i=3; i<=n;i++){
		int ans=0;
		cnt+=dp[i-3];
		ans+=dp[i-2];
		ans+=dp[i-1];
		ans+=cnt*2;
		dp.push_back(ans);
	}
	cout<<dp[n];
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1812 KiB
2Accepted0/03ms2056 KiB
3Accepted2/23ms2264 KiB
4Accepted2/22ms2352 KiB
5Accepted2/23ms2480 KiB
6Accepted2/22ms2636 KiB
7Accepted2/22ms2720 KiB
8Accepted3/32ms2872 KiB
9Accepted3/32ms2812 KiB
10Accepted3/32ms2936 KiB
11Accepted3/33ms3148 KiB
12Accepted3/33ms3236 KiB
13Accepted3/32ms3264 KiB
14Accepted3/32ms3332 KiB
15Accepted3/33ms3328 KiB
16Accepted3/33ms3576 KiB
17Accepted3/32ms3664 KiB