Cod sursa(job #2158373)
Utilizator | Chita Catalin Adrian daytarel | Data | 10 martie 2018 12:24:13 |
---|---|---|---|
Problema | Rsir | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream f("rsir.in");
ofstream g("rsir.out");
int t1,t0,m,a,b,x,y,z;
long long n;
int rec(int T)
{
if(T==0)return t0;
else if(T==1)return t1;
else return a*pow(rec(T-2),2)+b*pow(rec(T-1),2)+ x*rec(T-2)+y*rec(T-1)+z;
}
int main()
{ int i;
f>>t0>>t1>>a>>b>>x>>y>>z>>m>>n;
g<<rec(n)%m;
return 0;
}