Cod sursa(job #1089864)
Utilizator | Data | 21 ianuarie 2014 23:41:05 | |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <fstream>
#include <iostream>
using namespace std;
int main()
{int t,x,y,z,a,b,c,n,q,w,k,i,j,s;
ifstream IN("iepuri.in");
ofstream OUT("iepuri.out");
IN>>t;
for(i=1;i<=t;i++)
{IN>>x;
IN>>y>>z>>a>>b>>c>>n;
q=z;w=y;k=x;
for(j=3;j<=n;j++)
{
s=a*q+b*y+k*x;
k=b;b=q;q=s;
}
OUT<<s%666013<<endl;
}
IN.close();
OUT.close();
return 0;
}