6702021-11-07 11:08:28TSomaToronyépítés (2,2,3,3)cpp14Wrong answer 0/402ms1208 KiB
#undef _GLIBCXX_DEBUG
#pragma GCC optimize("Ofast,inline")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <stdio.h>
#include <stdint.h>

using namespace std;

long long N, i, a, b, c, d;
long long const P = 20210108;

int main()
{
#pragma warning(suppress : 4996)
	scanf("%d\n", &N);

	switch (N)
	{
	case 1:printf("%d\n", 2);break;
	case 2:printf("%d\n", 4);break;
	case 3:printf("%d\n", 10);break;
	default:
		a = 2;
		b = 4;
		c = 10;
		for (i = 4; i <= N; ++i)
		{
			d = (2 * (a + c)) % P;
			a = b;
			b = c;
			c = d;
		}
		printf("%d\n", d % P);
		break;
	}
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Wrong answer0/02ms1156 KiB
2Wrong answer0/01ms1140 KiB
3Wrong answer0/21ms1144 KiB
4Wrong answer0/21ms1140 KiB
5Wrong answer0/31ms1204 KiB
6Wrong answer0/31ms1076 KiB
7Wrong answer0/32ms1076 KiB
8Wrong answer0/32ms1204 KiB
9Wrong answer0/31ms1204 KiB
10Wrong answer0/31ms1204 KiB
11Wrong answer0/32ms1208 KiB
12Wrong answer0/32ms1140 KiB
13Wrong answer0/42ms1204 KiB
14Wrong answer0/42ms1204 KiB
15Wrong answer0/21ms1208 KiB
16Wrong answer0/21ms1204 KiB