Cod sursa(job #2186657)
Utilizator | Data | 25 martie 2018 20:27:43 | |
---|---|---|---|
Problema | Iepuri | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <fstream>
using namespace std;
ifstream in("iepuri.in");
ofstream out("iepuri.out");
int main()
{
int t;
in >>t;
while(t--)
{
int x, y, z, a, b, c;
int32_t n;
in >>x >>y >>z >>a >>b >>c >>n;
n -= 2;
while(n--){
int aux = (a*z + b*y + c*x)%666013;
x = y;
y = z;
z = aux;
}
out<<z<<'\n';
}
return 0;}