4842021-11-03 18:07:35TSomaToronyépítés (1,1,3,3)cpp11Wrong answer 48/504ms1972 KiB
#include <iostream>

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

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

    unsigned int a = 2;
    unsigned int b = 4;
    unsigned 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 >= 20210108 ? a % 20210108 : a;
        b = b >= 20210108 ? b % 20210108 : b;
        c = c >= 20210108 ? c % 20210108 : c;
    }

    switch (N >= 3 ? N % 3 : a)
    {
    case 0:
        std::cout << c;
        break;
    case 1:
        std::cout << a;
        break;
    case 2:
        std::cout << b;
        break;
    }
}
SubtaskSumTestVerdictTimeMemory
base48/50
1Accepted0/02ms1880 KiB
2Accepted0/02ms1940 KiB
3Accepted3/31ms1968 KiB
4Accepted3/31ms1972 KiB
5Accepted4/41ms1964 KiB
6Accepted4/41ms1972 KiB
7Accepted4/44ms1968 KiB
8Accepted4/42ms1972 KiB
9Accepted4/41ms1968 KiB
10Accepted4/41ms1968 KiB
11Accepted4/42ms1972 KiB
12Accepted4/44ms1968 KiB
13Accepted4/44ms1972 KiB
14Accepted4/42ms1964 KiB
15Accepted2/22ms1964 KiB
16Wrong answer0/21ms1964 KiB