当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
After defeating the evil nation of TN and road reconstruction, the nation of Phoenix is now in perfect harmony. But as every old story goes, evil things will keep happening now and then. This day, a letter arrived at Ikki’s, saying that his friend, frkstyc, was kidnapped in the Wonderland of TopCoders.
It is not known who kidnapped frkstyc but it is known that he is a favorite of algorithmic contests and the reason for his kidnapping frkstyc was that he can’t solve a enumeration problem =.=, so he kidnapped frkstyc to help him. (What? Why not kidnap ACRush? Well… Still remember the story told by Guo Wei in Xi’an? — “Then why me but not somebody else!!”, yells frkstyc.)
Well, now frkstyc’s life is at stake! He is encountered with such a problem:
You know what a tree in graph theory is, right? Well, I’m interested in numbering the trees in such a way that the number of a vertex is always smaller than those of its descendants. And I’m interested in making the trees into forests such that there are n nodes and k leaves, satisfying the above property in each tree. Now tell me how many ways can I number such forests!
Being a contestant at POJ, you’re sure that if there’s no frkstyc, there will be no POJ Monthly for a time… So try your best to save his life!
The input contains one or more lines ended with an integer pair “0 0
”. Each of the above lines contains two integers n, k (n, k ≤ 500), respectively.
1 1 3 2 0 0
1 4
时间上限 | 内存上限 |
3000 | 262144 |