Cod sursa(job #1751355)
Utilizator | Data | 1 septembrie 2016 11:59:01 | |
---|---|---|---|
Problema | Iepuri | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<fstream>
int main()
{
std::ifstream f("iepuri.in");
std::ofstream g("iepuri.out");
int t, x, y, z, a, b, c, n;
f >> t;
int x1, y1;
for (int i = 0; i < t; i++)
{
f >> x >> y >> z >> a >> b >> c >> n;
for (int i = 3; i <= n; i++)
{
x1 = x % 666013;
y1 = y % 666013;
x = y1;
y = z;
z = (z*a + y1*b + x1*c) % 666013;
}
g << z << std::endl;
}
f.close();
g.close();
return 0;
}