1122021-01-13 07:40:22kidesoToronyépítés (2,2,3,3)cpp11Accepted 40/402ms2028 KiB
#include <iostream>

using namespace std;

long long N, i, a, b, c, d;
long long const P = 20210108;

int main()
{
	cin >> N;
	if (N == 1) cout << 0;
	else if (N == 2) cout << 2;
	else if (N == 3) cout << 2;
	else
	{
		a = 0;
		b = 2;
		c = 2;
		for (i = 4; i <= N; ++i)
		{
			d = (2 * (a + b)) % P;
			a = b;
			b = c;
			c = d;
		}

		cout << d;
	}

	cout << '\n';
		
		return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms1864 KiB
2Accepted0/01ms1900 KiB
3Accepted2/21ms1964 KiB
4Accepted2/21ms1972 KiB
5Accepted3/31ms1976 KiB
6Accepted3/31ms1980 KiB
7Accepted3/31ms1984 KiB
8Accepted3/31ms1984 KiB
9Accepted3/31ms1992 KiB
10Accepted3/31ms2000 KiB
11Accepted3/32ms2000 KiB
12Accepted3/32ms2000 KiB
13Accepted4/42ms2004 KiB
14Accepted4/41ms2020 KiB
15Accepted2/21ms2024 KiB
16Accepted2/21ms2028 KiB