ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1175. Strange Sequence

Important fix!
Posted by Denis Koshman 7 Sep 2008 13:32
"You may assume that all intermediate values of H and all values of F fit in range [0..100000]"

This should be put to problem statement, rather than to input description. Otherwise claim about periodicity is wrong.

Consider the following sequence:

X1=0, X2=2
A1=0, A2=0, A3=2, A4=0
B1=3, B2=2, C=5

0 2 -1 -2 -4 -8 -16 ... -(2^n) ...

It's not periodic, but all coefficients (as well as initial elements) are non-negative.