6662021-11-07 10:41:45TSomaToronyépítés (1,1,3,3)cpp14Wrong answer 0/504ms2028 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
base0/50
1Wrong answer0/02ms1932 KiB
2Wrong answer0/01ms1928 KiB
3Wrong answer0/31ms1972 KiB
4Wrong answer0/31ms1976 KiB
5Wrong answer0/41ms1976 KiB
6Wrong answer0/42ms1980 KiB
7Wrong answer0/44ms1992 KiB
8Wrong answer0/41ms1992 KiB
9Wrong answer0/41ms1996 KiB
10Wrong answer0/41ms1996 KiB
11Wrong answer0/42ms2000 KiB
12Wrong answer0/44ms2012 KiB
13Wrong answer0/44ms2012 KiB
14Wrong answer0/42ms2016 KiB
15Wrong answer0/21ms2016 KiB
16Wrong answer0/21ms2028 KiB