Cod sursa(job #1959698)
Utilizator | Data | 9 aprilie 2017 20:09:18 | |
---|---|---|---|
Problema | Iepuri | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <iostream>
#include <fstream>
using namespace std;
long long x, y, z, a, b, c, t, i, j, mod, y2, x2;
long long n;
int main () {
ifstream fin("iepuri.in");
ofstream fout("iepuri.out");
mod = 666013;
fin >> t;
for (j = 1; j <= t; j++)
{
fin >> x >> y >> z >> a >> b >> c >> n;
for (i = 1; i <= n-2; i++)
{
x2 = x; y2 = y;
x = y;
y = z;
z = (a*z + b*y2 + c*x2) % mod;
}
fout << z << "\n";
}
}