5162021-11-03 19:12:12Kris030Toronyépítés (1,1,3,3)cpp11Accepted 50/503ms1220 KiB
#include "stdio.h"

using namespace std;

int main() {

	typedef unsigned long long int ulli;
	const ulli MODNUM = 20210108, LMODNUM3 = MODNUM * 1000, LMODNUM5 = LMODNUM3 * 100;
	ulli a = 2, b = 4, c = 10;

	typedef unsigned int NT;
	NT N;
	scanf("%d", &N);

	for (NT n = 3; n < N; n += 3) {
		a = 2 * (c + a);
		b = 2 * (a + b);
		c = 2 * (b + c);

		if (a >= LMODNUM5) a %= LMODNUM3;
		if (b >= LMODNUM5) b %= LMODNUM3;
		if (c >= LMODNUM5) c %= LMODNUM3;
	}

	switch (N >= 3 ? N % 3 : N) {
		case 0: printf("%d", c % MODNUM); break;
		case 1: printf("%d", a % MODNUM); break;
		case 2: printf("%d", b % MODNUM); break;
	}
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1220 KiB
2Accepted0/01ms1180 KiB
3Accepted3/31ms1208 KiB
4Accepted3/31ms1204 KiB
5Accepted4/41ms1204 KiB
6Accepted4/41ms1204 KiB
7Accepted4/43ms1168 KiB
8Accepted4/41ms1076 KiB
9Accepted4/41ms1208 KiB
10Accepted4/41ms1144 KiB
11Accepted4/41ms1204 KiB
12Accepted4/43ms1136 KiB
13Accepted4/43ms1144 KiB
14Accepted4/42ms1204 KiB
15Accepted2/21ms1204 KiB
16Accepted2/21ms1076 KiB