Page 2 of 2

Re: 10754 - Fantastic Sequence

Posted: Wed Jul 06, 2011 10:49 pm
by Shafaet_du
Nice problem (it was a tougher one for me).

I used this mod function for handling negative numbers:

Code: Select all

i64 mod(i64 a,i64 m)
{
	if(a>0) return a%m;
	if(a==0) return 0;
	a=a*-1;
	i64 M=a%m;
	if(M==0) return 0;
	return m-M;
}

Re: 10754 - Fantastic Sequence

Posted: Mon Jan 11, 2016 5:20 am
by red_apricot
I do so wonder whether the formula in the problem statement is wrong? Should it be a_n = \sum_{i=1}^{k}c_i\times{a_{n-i}}+c_{k+1}\times(n\geq k)?