Cod sursa(job #3157843)
Utilizator | Antonie Danoiu Tonyy | Data | 16 octombrie 2023 22:44:43 |
---|---|---|---|
Problema | Iepuri | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | HLO 2023 - Cls 11-12 - Tema 0 | Marime | 0.5 kb |
#include <fstream>
using namespace std;
ifstream fin ("iepuri.in");
ofstream fout("iepuri.out");
long long int x, y, z, a, b, c, n, t, i;
int main()
{
fin >> t;
for (int q = 1 ; q <= t ; ++q)
{
fin >> x >> y >> z >> a >> b >> c >> n;
long long int s[n];
s[0] = x;
s[1] = y;
s[2] = z;
for ( i = 3 ; i <= n ; ++i)
s[i] = a * s[i-1] + b * s[i-2] + c * s[i-3];
fout << s[n] % 666013 << "\n";
}
return 0;
}