1542021-02-03 20:03:48kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Accepted 50/5013ms17404 KiB
#include <iostream>
#include <vector>

using namespace std;

int main() {
	cin.sync_with_stdio(false);
	cin.tie(nullptr);

	int N;
	cin >> N;
	vector<long long> variationS(N + 1);
	variationS[0] = 1;
	for (int i = 1; i <= N; i++) {
		variationS[i] = variationS[i - 1] * 2;
		if (i > 2) {
			variationS[i] += variationS[i - 3] * 2;
		}
		variationS[i] %= 20210108;
	}
	cout << variationS[N] << '\n';
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1756 KiB
2Accepted0/01ms1812 KiB
3Accepted3/31ms1860 KiB
4Accepted3/31ms1860 KiB
5Accepted4/41ms1868 KiB
6Accepted4/41ms1868 KiB
7Accepted4/413ms17404 KiB
8Accepted4/43ms3632 KiB
9Accepted4/41ms1880 KiB
10Accepted4/41ms1888 KiB
11Accepted4/43ms4816 KiB
12Accepted4/413ms17036 KiB
13Accepted4/410ms15356 KiB
14Accepted4/44ms6904 KiB
15Accepted2/21ms1908 KiB
16Accepted2/21ms1912 KiB