4812021-11-03 17:58:01TSomaToronyépítés (1,1,3,3)cpp11Wrong answer 4/504ms1912 KiB
#include <iostream>

int fast_mod(const int input, const int ceil) {
    return input >= ceil ? input % ceil : input;
}

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

    int N;
    std::cin >> N;

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

        a = fast_mod(a, 20210108);
        b = fast_mod(b, 20210108);
        c = fast_mod(c, 20210108);
    }

    switch (fast_mod(a, N))
    {
    case 0:
        std::cout << c;
        break;
    case 1:
        std::cout << a;
        break;
    case 2:
        std::cout << b;
        break;
    }
}
SubtaskSumTestVerdictTimeMemory
base4/50
1Wrong answer0/02ms1832 KiB
2Wrong answer0/01ms1844 KiB
3Wrong answer0/31ms1908 KiB
4Wrong answer0/31ms1904 KiB
5Wrong answer0/41ms1908 KiB
6Accepted4/41ms1904 KiB
7Wrong answer0/44ms1908 KiB
8Wrong answer0/41ms1908 KiB
9Wrong answer0/41ms1908 KiB
10Wrong answer0/41ms1908 KiB
11Wrong answer0/41ms1908 KiB
12Wrong answer0/44ms1904 KiB
13Wrong answer0/44ms1904 KiB
14Wrong answer0/42ms1908 KiB
15Wrong answer0/21ms1912 KiB
16Wrong answer0/21ms1908 KiB