A simple way to correct solution

If you use formula in C++, you don't need the long arithmetics. Use long double and you'll get AC.

Re: A simple way to correct solution

i used long double,

2 4 6 29 -1000

but my answer is -6.00693e+208, is it correct or not?

Re: A simple way to correct solution

Posted by

aybek 17 Aug 2014 19:40

you should turn off siencetific notation

Re: A simple way to correct solution

Posted by

A_Le_K 18 Feb 2015 14:27

My approach goes like this: lets choose a big random prime P > 10^16, and calculate F_(i+1)%P.