6032021-11-04 17:53:20TSomaToronyépítés (1,1,3,3)cpp14Elfogadva 50/502ms1208 KiB
#include <stdio.h>
#include <stdint.h>

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

int main()
{
    int N;
#pragma warning(suppress : 4996)
    scanf("%d\n", &N);    

    int_fast32_t a = 2;
    int_fast32_t b = 4;
    int_fast32_t c = 10;
    int_fast32_t d = 24;
    int_fast32_t e = 56;
    int_fast32_t f = 132;

    int_fast8_t x = 2;

    int_fast32_t ceiling1 = 10105054000000000;
    int_fast32_t ceiling2 = 202101080000;
    int_fast32_t ceiling3 = 20210108;

    N -= 6;

    while (N > 0)
    {
        a = x * (f + d);
        b = x * (a + e);
        c = x * (b + f);
        d = x * (c + a);
        e = x * (d + b);
        f = x * (e + c);

        if (f >= ceiling1) {
            d %= ceiling2;
            e %= ceiling2;
            f %= ceiling2;
        }

        N -= 6;
    }


    switch (N % 6) {
        case 0: printf("%d\n", f % ceiling3); break;
        case -1: printf("%d\n", e % ceiling3); break;
        case -2: printf("%d\n", d % ceiling3); break;
        case -3: printf("%d\n", c % ceiling3); break;
        case -4: printf("%d\n", b % ceiling3); break;
        case -5: printf("%d\n", a % ceiling3); break;
    }
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/02ms1156 KiB
2Elfogadva0/01ms1184 KiB
3Elfogadva3/31ms1144 KiB
4Elfogadva3/31ms1204 KiB
5Elfogadva4/41ms1140 KiB
6Elfogadva4/41ms1140 KiB
7Elfogadva4/42ms1204 KiB
8Elfogadva4/41ms1140 KiB
9Elfogadva4/41ms1112 KiB
10Elfogadva4/41ms1140 KiB
11Elfogadva4/41ms1208 KiB
12Elfogadva4/42ms1080 KiB
13Elfogadva4/42ms1144 KiB
14Elfogadva4/41ms1052 KiB
15Elfogadva2/21ms1140 KiB
16Elfogadva2/21ms1140 KiB