3922021-11-03 08:25:05arralToronyépítés (1,1,3,3)cpp11Runtime error 45/5014ms17408 KiB
#include <iostream>
#include <vector>
using namespace std;
int main()
{
   
	int magassag=0;
	cin >> magassag;
	vector<unsigned long long> lista(magassag+1,0);
	lista[0] = 0;
	lista[1] = 2;
	lista[2] = 4;
	lista[3] = 10;

	for (size_t i = 4; i < magassag+1; i++)
	{
		lista[i] = (2*lista[i - 3] + 2*lista[i-1]) % 20210108;
	}
	
	if (magassag == 1)
	{
		cout << lista[1];
	}
	else if (magassag == 2)
	{
		cout << lista[2];
	}
	else if (magassag == 3)
	{
		cout << lista[3];
	}
	else
	{
		
		cout << lista[magassag];
	}


}
SubtaskSumTestVerdictTimeMemory
base45/50
1Accepted0/02ms1744 KiB
2Accepted0/01ms1780 KiB
3Accepted3/31ms1720 KiB
4Runtime error0/31ms1816 KiB
5Accepted4/41ms1824 KiB
6Accepted4/41ms1824 KiB
7Accepted4/414ms17408 KiB
8Accepted4/43ms3596 KiB
9Accepted4/41ms1824 KiB
10Accepted4/41ms1820 KiB
11Accepted4/44ms4812 KiB
12Accepted4/414ms17040 KiB
13Accepted4/413ms15368 KiB
14Accepted4/44ms6924 KiB
15Accepted2/21ms1824 KiB
16Runtime error0/21ms1816 KiB