5112021-11-03 18:54:53TSomaToronyépítés (1,1,3,3)cpp11Accepted 50/504ms1908 KiB
#include <iostream>

int main()
{
    std::cin.sync_with_stdio(false);
    std::cin.tie(nullptr);

    unsigned int N;
    std::cin >> N;

    unsigned long long int a = 2;
    unsigned long long int b = 4;
    unsigned long long int c = 10;

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

        a = a >= 2021010800000 ? a % 2021010800000 : a;
        b = b >= 2021010800000 ? b % 2021010800000 : b;
        c = c >= 2021010800000 ? c % 2021010800000 : c;
    }

    switch (N >= 3 ? N % 3 : N)
    {
    case 0:
        std::cout << c % 20210108;
        break;
    case 1:
        std::cout << a % 20210108;
        break;
    case 2:
        std::cout << b % 20210108;
        break;
    }
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1820 KiB
2Accepted0/01ms1840 KiB
3Accepted3/31ms1904 KiB
4Accepted3/31ms1904 KiB
5Accepted4/41ms1904 KiB
6Accepted4/44ms1904 KiB
7Accepted4/44ms1904 KiB
8Accepted4/42ms1900 KiB
9Accepted4/41ms1908 KiB
10Accepted4/41ms1904 KiB
11Accepted4/41ms1904 KiB
12Accepted4/44ms1904 KiB
13Accepted4/44ms1904 KiB
14Accepted4/42ms1904 KiB
15Accepted2/21ms1900 KiB
16Accepted2/21ms1904 KiB