Cod sursa(job #2637640)

Utilizator MacaroaneFierteSimandan Paul MacaroaneFierte Data 23 iulie 2020 19:45:20
Problema Iepuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <fstream>

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 = a * z + b * y + c * x;
            x = y, y = z, z = s;
        }
        out << s << '\n';
        s = 0;
    }
    return 0;
}