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

I understand myself. Here is explaining
Posted by IlushaMax 12 Mar 2016 16:59
Let W is WHITE, R is RED, B is BLUE
So for n=1:
f(n)=2
W or R;
for n=2:
f(n)=2 too
WR or RW;
And now the most interesting:
for n=3:
f(n)=
We add to combinations of n-1 W or R:  WRW or RWR;
+
We add to combinations of n-2 RB or WB: RBW or WBR;
=f(n-1)+f(n-2);
So you can check it for n=4 and n=5///It's really easy