首页 > ACM题库 > HDU-杭电 > hdu 2595 Crowded Forest Wildlife-待解决[解题报告]C++
2014
02-10

hdu 2595 Crowded Forest Wildlife-待解决[解题报告]C++

Crowded Forest Wildlife

问题描述 :

The WWF volunteers are back again to collect more wildlife from Gump Forest! Animals have moved around the forest, and some trails are getting more crowded!. Lisa finds that the same type of animal may now be found living on multiple trails connected to the same clearing.
Elsewhere in the forest trails may have no animals living on it. If a trail has no animals, the WWF truck can drive along it any time without collecting any animals. Can Lisa still guide the WWF volunteers through the forest and fill up their truck?

输入:

Animals are given as words(lowercases). Clearings are given as numbers. There may be up to 500 clearings. Clearing 0 is always the entrance to Gump Forest.
The input begins with the Gump Forest trail map. Each line describes a trail between two clearings as a pair of numbers, followed by a list of animals living on the trail. There are no more than 1000 trails and the number of animals on each trail will not exceed 30. Remaining lines begain with list of animals to be collected, in the order they are to be collected.

输出:

Animals are given as words(lowercases). Clearings are given as numbers. There may be up to 500 clearings. Clearing 0 is always the entrance to Gump Forest.
The input begins with the Gump Forest trail map. Each line describes a trail between two clearings as a pair of numbers, followed by a list of animals living on the trail. There are no more than 1000 trails and the number of animals on each trail will not exceed 30. Remaining lines begain with list of animals to be collected, in the order they are to be collected.

样例输入:

1 3 puma
2 3 lynx
0 3 toad
0 1
0 2
puma lynx
lynx toad
puma lynx toad
1 0 puma
1 2 puma
2 0 puma
puma puma puma 
puma

样例输出:

Succeeded
Succeeded
Failed
Succeeded
Failed

 


,
  1. 代码是给出了,但是解析的也太不清晰了吧!如 13 abejkcfghid jkebfghicda
    第一步拆分为 三部分 (bejk, cfghi, d) * C(13,3),为什么要这样拆分,原则是什么?