110392024-07-02 17:25:40GervidToronyépítés (80 pont)cpp17Accepted 80/8018ms6736 KiB
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main()
{
	iostream::sync_with_stdio(0);
	cin.tie(0);

	int n, x;
	cin >> n;

	vector<int> vec(3);
	vec[1] = 3;
	vec[2] = 10;
	for (int i = 3; i <= n; i++)
	{
		x = vec[i - 2] + 3 * vec[i - 1];
		vec.push_back(x % 20210108);
	}
	
	cout << vec[n];
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms640 KiB
2Accepted0/03ms488 KiB
3Accepted4/43ms524 KiB
4Accepted4/43ms416 KiB
5Accepted5/53ms512 KiB
6Accepted5/53ms496 KiB
7Accepted6/618ms6664 KiB
8Accepted6/64ms1432 KiB
9Accepted7/72ms488 KiB
10Accepted7/73ms356 KiB
11Accepted8/86ms2084 KiB
12Accepted8/817ms6736 KiB
13Accepted8/814ms6692 KiB
14Accepted8/86ms2008 KiB
15Accepted2/23ms504 KiB
16Accepted2/22ms356 KiB