3742021-11-03 08:14:25hentesoposszumToronyépítés (1,1,3,3)cpp11Accepted 50/5016ms9500 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n;
	cin >> n;

	vector<int> b(n + 1);

	b[0] = 0;
	b[1] = 2;
	b[2] = 4;
	b[3] = 10;

	if (n < 4) {
		cout << b[n] << endl;
		return 0;
	}

	for (int i = 4; i <= n; i++) {
		b[i] = (2 * b[i - 1] + 2 * b[i - 3]) % 20210108;
	}

	cout << b[n] << endl;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1740 KiB
2Accepted0/01ms1792 KiB
3Accepted3/31ms1844 KiB
4Accepted3/31ms1848 KiB
5Accepted4/41ms1860 KiB
6Accepted4/41ms1856 KiB
7Accepted4/416ms9480 KiB
8Accepted4/42ms2596 KiB
9Accepted4/41ms1868 KiB
10Accepted4/41ms1872 KiB
11Accepted4/44ms3256 KiB
12Accepted4/414ms9500 KiB
13Accepted4/49ms8460 KiB
14Accepted4/44ms4308 KiB
15Accepted2/21ms1896 KiB
16Accepted2/21ms1900 KiB