Cod sursa(job #2073531)
Utilizator | Pop Alex-Nicolae AlexPop28 | Data | 23 noiembrie 2017 11:56:51 |
---|---|---|---|
Problema | Rsir | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#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;
}