50882023-04-16 11:11:05Laci3000Toronyépítés (80 pont)cpp17Accepted 80/8014ms18468 KiB

#include <iostream>
#include <vector>

using namespace std;

int main()
{

	int hossz;
	cin >> hossz;

	vector<long long> lista(hossz);

	lista[0] = 3;
	if (hossz > 1) {
		lista[1] = 10;
	}
	if (hossz > 2) {
		for (size_t i = 2; i < hossz; i++)
		{
			lista[i] = (lista[i - 1] * 3 + lista[i - 2]) % 20210108;
		}
	}

	cout << lista[hossz - 1];
}

SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms2088 KiB
2Accepted0/03ms2232 KiB
3Accepted4/43ms2280 KiB
4Accepted4/43ms2376 KiB
5Accepted5/53ms2732 KiB
6Accepted5/53ms2800 KiB
7Accepted6/614ms18452 KiB
8Accepted6/64ms4732 KiB
9Accepted7/73ms3116 KiB
10Accepted7/73ms3356 KiB
11Accepted8/84ms6280 KiB
12Accepted8/814ms18468 KiB
13Accepted8/813ms17036 KiB
14Accepted8/87ms8672 KiB
15Accepted2/23ms3700 KiB
16Accepted2/23ms3696 KiB