6052021-11-04 18:20:28TSomaToronyépítés (1,1,3,3)cpp14Elfogadva 50/502ms1352 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);    

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

    uint_fast32_t x = 2;

    uint_fast32_t ceiling1 = 10105054000000000;
    uint_fast32_t ceiling2 = 202101080000;
    uint_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/02ms1224 KiB
2Elfogadva0/02ms1180 KiB
3Elfogadva3/31ms1312 KiB
4Elfogadva3/31ms1312 KiB
5Elfogadva4/41ms1168 KiB
6Elfogadva4/41ms1316 KiB
7Elfogadva4/42ms1324 KiB
8Elfogadva4/41ms1324 KiB
9Elfogadva4/41ms1336 KiB
10Elfogadva4/41ms1272 KiB
11Elfogadva4/41ms1344 KiB
12Elfogadva4/42ms1276 KiB
13Elfogadva4/42ms1284 KiB
14Elfogadva4/41ms1288 KiB
15Elfogadva2/21ms1352 KiB
16Elfogadva2/21ms1300 KiB