Cod sursa(job #2843416)
Utilizator | Data | 2 februarie 2022 14:01:28 | |
---|---|---|---|
Problema | Iepuri | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <fstream>
using namespace std;
ifstream fin("iepuri.in");
ofstream fout("iepuri.out");
int n, x[5];
const int mod = 666013;
int main()
{
int t;
fin >> t;
for (int i = 1; i <= t; i++)
{
int a, b, c, n;
fin >> x[1] >> x[2] >> x[3] >> a >> b >> c >> n;
for (int j = 3; j <= n; j++)
{
x[4] = (c * x[1] + b * x[2] + a * x[3]) % mod;
x[1] = x[2];
x[2] = x[3];
x[3] = x[4];
}
fout << x[3]<<endl;
}
return 0;
}