Cod sursa(job #1334228)

Utilizator wGEORGEWGeorge Cioti wGEORGEW Data 4 februarie 2015 07:00:29
Problema Iepuri Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
//#include <iostream>
#include <fstream>
 
using namespace std;
 
long x,y,z,a,b,c,t,T;
long n;
 
int main()
{
 
   ifstream input("iepuri.in");
   ofstream output("iepuri.out");
 
    input >>T;
    while(input >>x>>y>>z>>a>>b>>c>>n)
{
for(int i = 1; i<=n-2; i++)    {
        t=(a*z+b*y+c*x)%666013;
         // 2 + 2 + 1 +1 , 6
        x=y;
        y=z;
        z=t;
    }
 
    output << t%666013 << '\n';
   }
    return 0;
}