4522021-11-03 15:13:52kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Accepted 50/506ms1908 KiB
#include <iostream>

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

	int N;
	std::cin >> N;
	int a = 0, b = 0, c = 1;
	while (2 < N) {
		a = 2 * (a + c) % 20210108;
		b = 2 * (b + a) % 20210108;
		c = 2 * (c + b) % 20210108;
		N -= 3;
	}
	switch (N) {
	case 0:
		std::cout << c;
		return 0;
	case 1:
		std::cout << 2 * (a + c) % 20210108;
		return 0;
	case 2:
		std::cout << 2 * (b + 2 * (a + c)) % 20210108;
		return 0;
	}
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1816 KiB
2Accepted0/01ms1844 KiB
3Accepted3/31ms1904 KiB
4Accepted3/31ms1900 KiB
5Accepted4/41ms1904 KiB
6Accepted4/41ms1900 KiB
7Accepted4/46ms1904 KiB
8Accepted4/42ms1904 KiB
9Accepted4/41ms1900 KiB
10Accepted4/41ms1908 KiB
11Accepted4/42ms1904 KiB
12Accepted4/46ms1904 KiB
13Accepted4/44ms1900 KiB
14Accepted4/43ms1908 KiB
15Accepted2/21ms1904 KiB
16Accepted2/21ms1904 KiB