Pagini recente » Cod sursa (job #3257613) | Atasamentele paginii Profil SerbanMihnea | Cod sursa (job #815998) | Cod sursa (job #230527) | Cod sursa (job #3269648)
#include <fstream>
using namespace std;
ifstream f("iepuri.in");
ofstream g("iepuri.out");
int main()
{
int T, x, y, z, a, b, c, n, nr;
f >> T;
for (int nu = 1; nu <= T; nu++)
{
f >> x >> y >> z >> a >> b >> c >> n;
for (int i = 3; i <= n; i++)
{
nr = (a * z + b * y + c * x) % 666013;
x = y;
y = z;
z = nr;
}
g << z << '\n';
}
return 0;
}