Cod sursa(job #1006518)

Utilizator pop_bogdanBogdan Pop pop_bogdan Data 7 octombrie 2013 10:40:37
Problema Iepuri Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <fstream>
using namespace std;

ifstream is ("iepuri.in");
ofstream os ("iepuri.out");

int a, b, c, x, y, z, n, t, s;

int main()
{
    is >> t;
    for ( int i = 1; i <= t; i++ )
    {
        is >> x >> y >> z >> a >> b >> c >> n;
        for ( int j = 3; j <= n; j++ )
        {
            s = a * z + b * y + c * x;
            x = y;
            y = z;
            z = s;
        }
        os << s << '\n';
    }

    is.close();
    os.close();
    return 0;
}