Pagini recente » Profil Ionut_margel | Monitorul de evaluare | Istoria paginii problema/butoaie | Poligoane | Cod sursa (job #2073531)
#include <iostream>
#include <fstream>
#define sqr(x) x*x
using namespace std;
ifstream fin ("rsir.in");
ofstream fout ("rsir.out");
void create (int p);
long long n,i,T, T2, T1, aux, a, b, x, y, z, M;
int main()
{
fin >> T2>> T1 >> a >> b >> x >> y >> z >> M >> n;
for(i=2; i<=n; i++)
create(i);
fout << T%M << " ";
}
void create (int p)
{
T = a*(sqr(T2)) + b*(sqr(T1)) + x*T2 + y*T1 + z;
T2 = T1;
T1 = T;
}