3242021-10-08 14:30:40OlgipolgiiToronyépítés (1,1,3,3)cpp11Accepted 50/5025ms26368 KiB
// torony.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int n;
	cin >> n;
    vector<unsigned long long int> tower{ 2, 4, 10 };
	for (size_t i = 0; i < n; i++)
	{
		if (i>=3)
		{
			tower.push_back((2 * tower[i - 1] + 2 * tower[i - 3]) % 20210108);
		}
	}
	unsigned long long int k = tower[n - 1];
	cout << k;
}

SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1740 KiB
2Accepted0/01ms1824 KiB
3Accepted3/31ms1828 KiB
4Accepted3/31ms1720 KiB
5Accepted4/41ms1824 KiB
6Accepted4/41ms1828 KiB
7Accepted4/425ms26364 KiB
8Accepted4/44ms5032 KiB
9Accepted4/41ms1720 KiB
10Accepted4/41ms1720 KiB
11Accepted4/47ms7996 KiB
12Accepted4/425ms26364 KiB
13Accepted4/425ms26368 KiB
14Accepted4/48ms8000 KiB
15Accepted2/21ms1720 KiB
16Accepted2/21ms1724 KiB