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 1260. Nudnik Photographer

my idea
Posted by yuanyuan 21 Apr 2009 11:41
You can search some small test data, then the solution is here:
For f[n], there're three ways to construct it.
Put 2 onto 2nd position, then it's f[n-1];
Put 3 onto 2nd position, put 2 onto 3rd position. This is
f[n-3]! (You must put 4 onto 4th position)
The last condition contains only one possible way like that (first odd, then even)
13578642
So f[n]=f[n-1]+f[n-3]+1.
Re: my idea
Posted by yuanyuan 21 Apr 2009 11:41
Good Job!You're quite clever!
Re: my idea
Posted by Psycho_Mantis 11 Dec 2010 13:28
Pal, you must have pains in eggs.....
Re: my idea
Posted by hliu20 21 May 2013 12:58
Really nice! How you get that, really smart!