Nu aveti permisiuni pentru a descarca fisierul grader_test18.ok
Cod sursa(job #1873100)
| Utilizator | Data | 8 februarie 2017 19:44:59 | |
|---|---|---|---|
| Problema | Iepuri | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream f("iepuri.in");
ofstream g("iepuri.out");
int T,x,y,z,a,b,c,n,v[3],M;
f >> T;
f.get();
while (T>0)
{
f >> x >> y >> z >> a >> b >> c >> n;
v[0]=x;
v[1]=y;
v[2]=z;
while (n>2)
{
M=a*v[2]+b*v[1]+c*v[0];
v[0]=v[1];
v[1]=v[2];
v[2]=M;
n--;
}
g << v[2]%666013 << "\n";
T--;
f.get();
}
f.close();
g.close();
return 0;
}
