87602024-01-29 11:12:39GervidToronyépítés (1,1,3,3)cpp17Accepted 50/508ms3980 KiB
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <limits.h>
#include <map>
#include <stack>
#include <algorithm>

using namespace std;

int main()
{
	int n, i;
	cin >> n;

	int a = 2, b = 4, c = 10, temp;

	switch (n)
	{
	case 1:
		cout << a;
		return 0;
	case 2:
		cout << b;
		return 0;
	case 3:
		cout << c;
		return 0;
	default:
		for (i = 0; i < n - 3; i++)
		{
			temp = b;
			b = c;
			c = (c * 2 + a * 2) % 20210108;
			a = temp;
		}

		cout << c;
	}
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2120 KiB
3Accepted3/33ms2332 KiB
4Accepted3/33ms2540 KiB
5Accepted4/43ms2752 KiB
6Accepted4/43ms2816 KiB
7Accepted4/48ms3012 KiB
8Accepted4/43ms3224 KiB
9Accepted4/42ms3308 KiB
10Accepted4/43ms3560 KiB
11Accepted4/44ms3672 KiB
12Accepted4/48ms3888 KiB
13Accepted4/48ms3972 KiB
14Accepted4/44ms3976 KiB
15Accepted2/23ms3972 KiB
16Accepted2/23ms3980 KiB