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 1225. Flags

dynamic solution
Posted by Zero 11 Oct 2011 16:42
f(i,red)=f(i-2,white)+f(i-1,white)
f(i,white)=f(i-2,red)+f(i-1,red)

Use long long because when n=45 the answer exceeds maxlongint.
Re: dynamic solution
Posted by luckysundog 13 Oct 2011 04:42
1) ...and we get just doubled fibonacci sequence.
2) unsigned long is enough ;)