Cod sursa(job #2549761)

Utilizator Florinos123Gaina Florin Florinos123 Data 17 februarie 2020 23:13:50
Problema Iepuri Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>
#define mod 666013

using namespace std;

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

int t, a, b, c, n, nr, i;
long long x, y, z, aux;

int main()
{
  f >> t;
    for (i=1; i<=t; i++)
    {
        f >> x >> y >> z >> a >> b >> c >> n;
        nr = 3;
         while (nr <= n)
         {
             nr ++;
             aux = ((z * a ) % mod + (y * b) % mod + (x * c) % mod) % mod;
             x = y;
             y = z;
             z = aux;
         }
       g << z << '\n';
    }
    return 0;
}