Cod sursa(job #2003724)

Utilizator attack2002Girban Alexandru attack2002 Data 23 iulie 2017 19:02:35
Problema Rsir Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include<fstream>
using namespace std;
int main()
{
    ifstream read("rsir.in");
    ofstream write("rsir.out");
    unsigned long long int t,s,temp2;
    read>>t>>s;
    int a,b,x,y,z;
    read>>a>>b>>x>>y>>z;
    int M,n;
    read>>M>>n;
    for(long long int i=0;i<n-1;++i)
    {
        temp2=t%M;
        t=((a*s*s)%M + (b*temp2*temp2)%M + (x*s)%M + (y*temp2)%M + z%M)%M;
        s=temp2;
    }
    write<<t;
}