3782021-11-03 08:15:52JaksicsPéterToronyépítés (1,1,3,3)cpp11Wrong answer 0/50248ms1940 KiB
#include <iostream>
#include <vector>

using namespace std;

int torony(int);

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cout << i << "\t" << torony(i) << endl;
	}
}

int torony(int n) {
	int asd = 20210108;
	vector<unsigned long long> sorozat(n + 1);
	if (n == 1)
		return 2;
	else if(n == 2)
		return 4;
	else if(n == 3)
		return 10;
	else {
		sorozat[1] = 2;
		sorozat[2] = 4;
		sorozat[3] = 10;
		for (int i = 4; i < n + 1; i++)
		{
			sorozat[i] = (2*sorozat[i - 1] + 2*sorozat[i - 3])%asd;
		}
		return sorozat[n];
	}
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/02ms1812 KiB
2Wrong answer0/020ms1940 KiB
3Wrong answer0/31ms1920 KiB
4Wrong answer0/31ms1816 KiB
5Wrong answer0/41ms1920 KiB
6Wrong answer0/41ms1816 KiB
7Time limit exceeded0/4247ms1100 KiB
8Time limit exceeded0/4248ms1100 KiB
9Wrong answer0/41ms1816 KiB
10Wrong answer0/41ms1920 KiB
11Time limit exceeded0/4201ms1096 KiB
12Time limit exceeded0/4248ms1044 KiB
13Time limit exceeded0/4248ms1036 KiB
14Time limit exceeded0/4238ms1096 KiB
15Wrong answer0/21ms1920 KiB
16Wrong answer0/21ms1816 KiB