Hi. Can somebody tell me where the solution is wrong?
The task: http://img338.imageshack.us/img338/8097/task.png
My solution: Ideone.com | Online C++ Compiler & Debugging Tool
PS. I use Fibonacci sequence to designate the number of combinations (2,3,5,8,13,21,34...)