Cod sursa(job #1569869)

Utilizator iDanyelArvat Ovidiu Daniel iDanyel Data 15 ianuarie 2016 23:35:02
Problema Iepuri Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <iostream>
#include <fstream>
#define m 666013;
using namespace std;

int main()
{
    ifstream f("iepuri.in");
    ofstream g("iepuri.out");
    int t, x, y, z, a, b, c, n, i, j, aux;
    f >> t;
    for(i=1;i<=t;i++)
    {
        f >> x >> y >> z >> a >> b >> c >> n;
        int v[n];
        v[0]=x*a;
        v[1]=y*b;
        v[2]=z*c;
        for(j=3;j<=n;j++)
        {
            v[j]=(v[j-1]+v[j-2]+v[j-3])%m;
        }
        g << aux << endl;
    }
    f.close();
    g.close();
    return 0;
}