Cod sursa(job #2228645)

Utilizator andreisontea01Andrei Sontea andreisontea01 Data 4 august 2018 15:15:22
Problema Iepuri Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <iostream>
#include <fstream>

using namespace std;

const int mod = 666013;

int main()
{
    ifstream fin("iepuri.in");
    ofstream fout("iepuri.out");
    int x, y, z, a, b, c, n, t;
    fin >> t;
    for(int test = 1; test <= t; ++test){
        fin >> x >> y >> z >> a >> b >> c >> n;
        int day = 3, qty = 0;
        while(day <= n){
            qty = (1LL * x * c) % mod + (1LL * y * b) % mod + (1LL * z * a) % mod;
            day++;
            x = y;
            y = z;
            z = qty;
        }
        fout << qty << "\n";
    }
    return 0;
}