Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×
Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя nilsilu95

Автор nilsilu95, история, 9 лет назад, По-английски
Given n .You can choose n points in a circle and you have to draw lines joining them.Condition is each point can lie in only one line and no two lines can  intersect.You have to count number of line sequences possible.A line sequence is possible when we can draw lines from each points and satisfying the condtion mentioned above.

**Constraints**
1<=n<=50

Inputs
2
Output 
1

Inputs
4
Output 
2

Inputs
6
Output 
5

How to solve this?

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
9 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

This problem can be solved using DP in O(n^3).

http://community.topcoder.com/stat?c=problem_statement&pm=7868 http://apps.topcoder.com/forums//?module=RevisionHistory&messageID=1446345

Catalan Number is the answer of the problem for a particular n if you want to solve it using math.