6262021-11-04 21:59:20kovacs.peter.18fToronyépítés (1,1,3,3)cpp11Elfogadva 50/502ms1892 KiB
#include <iostream>

unsigned int N;
unsigned long long a, b, c;

int main() {
	std::cin >> N;
	switch (N % 24) {
	case 0: c = 1; break;
	case 1: b = 1; c = 2; break;
	case 2: a = 1; b = 2; c = 4; break;
	case 3: a = 2; b = 4; c = 10; break;
	case 4: a = 4; b = 10; c = 24; break;
	case 5: a = 10; b = 24; c = 56; break;
	case 6: a = 24; b = 56; c = 132; break;
	case 7: a = 56; b = 132; c = 312; break;
	case 8: a = 132; b = 312; c = 736; break;
	case 9: a = 312; b = 736; c = 1736; break;
	case 10: a = 736; b = 1736; c = 4096; break;
	case 11: a = 1736; b = 4096; c = 9664; break;
	case 12: a = 4096; b = 9664; c = 22800; break;
	case 13: a = 9664; b = 22800; c = 53792; break;
	case 14: a = 22800; b = 53792; c = 126912; break;
	case 15: a = 53792; b = 126912; c = 299424; break;
	case 16: a = 126912; b = 299424; c = 706432; break;
	case 17: a = 299424; b = 706432; c = 1666688; break;
	case 18: a = 706432; b = 1666688; c = 3932224; break;
	case 19: a = 1666688; b = 3932224; c = 9277312; break;
	case 20: a = 3932224; b = 9277312; c = 1677892; break;
	case 21: a = 9277312; b = 1677892; c = 11220232; break;
	case 22: a = 1677892; b = 11220232; c = 574872; break;
	case 23: a = 11220232; b = 574872; c = 4505528; break;
	}
	N /= 24;
	while (N--) {
		a += c;
		b += a << 1;
		c += b << 1;
		a += c;
		b += a << 1;
		c += b << 1;
		a += c;
		b += a << 1;
		c += b << 1;
		a += c;
		b += a << 1;
		c += b << 1;
		a += c;
		b += a << 1;
		c += b << 1;
		a += c;
		b += a << 1;
		c += b << 1;
		a += c;
		b += a << 1;
		c += b << 1;
		a = ((a + c) << 8) % 20210108;
		b = ((b << 8) + (a << 1)) % 20210108;
		c = ((c << 8) + (b << 1)) % 20210108;
	}
	std::cout << c;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/02ms1800 KiB
2Elfogadva0/01ms1852 KiB
3Elfogadva3/31ms1892 KiB
4Elfogadva3/31ms1784 KiB
5Elfogadva4/41ms1892 KiB
6Elfogadva4/41ms1784 KiB
7Elfogadva4/42ms1892 KiB
8Elfogadva4/41ms1788 KiB
9Elfogadva4/41ms1888 KiB
10Elfogadva4/41ms1888 KiB
11Elfogadva4/41ms1888 KiB
12Elfogadva4/42ms1784 KiB
13Elfogadva4/42ms1784 KiB
14Elfogadva4/41ms1884 KiB
15Elfogadva2/21ms1892 KiB
16Elfogadva2/21ms1888 KiB