Cod sursa(job #2637702)

Utilizator MacaroaneFierteSimandan Paul MacaroaneFierte Data 24 iulie 2020 12:29:03
Problema Iepuri Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <fstream>
#define MOD 666013

using namespace std;

ifstream in("iepuri.in");
ofstream out("iepuri.out");


int w, x, y, z, a, b, c, s, n;

int main() {
    in >> w;
    for (int q = 1; q <= w; q++) {
        in >> x >> y >> z >> a >> b >> c >> n;
        for (int i = 3; i <= n; i++) {
            s = (1LL * a * z + 1LL*b * y + 1LL * c * x)%MOD;
            x = y, y = z, z = s;
        }
        out << s << '\n';
        s = 0;
    }
    return 0;
}