4502021-11-03 14:48:15kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Accepted 50/509ms2032 KiB
#include <iostream>

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

	int N;
	std::cin >> N;
	int v[3]{ 0, 1, 0 };
	char c = 1;
	while (N--) {
		c = (c + 1) % 3;
		v[c] = 2 * (v[c] + v[(c + 2) % 3]);
		if (v[c] > 20210108) {
			v[c] %= 20210108;
		}
	}
	std::cout << v[c];
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1880 KiB
2Accepted0/01ms1984 KiB
3Accepted3/31ms2000 KiB
4Accepted3/31ms2004 KiB
5Accepted4/41ms2004 KiB
6Accepted4/41ms2016 KiB
7Accepted4/49ms2004 KiB
8Accepted4/42ms2016 KiB
9Accepted4/42ms2012 KiB
10Accepted4/41ms2008 KiB
11Accepted4/43ms2012 KiB
12Accepted4/49ms2032 KiB
13Accepted4/48ms2028 KiB
14Accepted4/44ms2016 KiB
15Accepted2/21ms2024 KiB
16Accepted2/21ms2028 KiB