昨天的荒地到见天的菜地# gardening - 拈花惹草
d*e
1 楼
A circus is designing a tower routine consisting of people standing atop one
another’s shoulders. For practical and aesthetic reasons, each person must
be both shorter and lighter than the person below him or her. Given the
heights and weights of each person in the circus, write a method to compute
the largest possible number of people in such a tower.
EXAMPLE:
Input (ht, wt): (65, 100) (70, 150) (56, 90) (75, 190) (60, 95) (68, 110)
Output: The longest tower is length 6 and includes from top to bottom: (56,
90)
(60,95) (65,100) (68,110) (70,150) (75,190)
这个问题给出的算法思路貌似不对?
比如说对于下面的输出:
(1, 2) (2, 3) (3, 9) (4, 5) (5, 6) (9, 4)
最大的输出应该是:
(1, 2) (2, 3) (4, 5) (5, 6)
请教这个问题如何解?
another’s shoulders. For practical and aesthetic reasons, each person must
be both shorter and lighter than the person below him or her. Given the
heights and weights of each person in the circus, write a method to compute
the largest possible number of people in such a tower.
EXAMPLE:
Input (ht, wt): (65, 100) (70, 150) (56, 90) (75, 190) (60, 95) (68, 110)
Output: The longest tower is length 6 and includes from top to bottom: (56,
90)
(60,95) (65,100) (68,110) (70,150) (75,190)
这个问题给出的算法思路貌似不对?
比如说对于下面的输出:
(1, 2) (2, 3) (3, 9) (4, 5) (5, 6) (9, 4)
最大的输出应该是:
(1, 2) (2, 3) (4, 5) (5, 6)
请教这个问题如何解?