两个吃奶一个添下面视频_人妻第一页香蕉网_欧美xxxx少妇_妺妺窝人体色www婷婷

2205 問題 E: Cleaning Robots(L)

時間限制: 1s 內(nèi)存限制: 256MB 提交: 8 解決: 2
題目描述

The new ICPC town has N junctions (numbered from 1 to N) which are connected by N?1 roads. It is possible from one junction to go to any other junctions by going through one or more roads. To make sure all the junctions are well-maintained, the government environment agency is planning to deploy their newest advanced cleaning robots. In addition to its cleaning ability, each robot is also equipped with a movement ability such that it can move from one junction to any other junctions connected by roads. However, as you might have guessed, such robots are not cheap. Therefore, the agency is considering the following deployment plan.

Let Tk be the set of junctions which should be cleaned by the kth robot (also known as, the robot's task), and |Tk|≥1 be the number of junctions in Tk. The junctions in Tk form a path, i.e. there exists a sequence of v1,v2,…,v|Tk| where vi∈Tk and vi≠vj for all i≠j such that each adjacent junction in this sequence is connected by a road. The union of T for all robots is equal to the set of all junctions in ICPC town. On the other hand, no two robots share a common junction, i.e. Ti∩Tj=? if i≠j.

To avoid complaints from citizens for an inefficient operation, the deployment plan should be irreducible; in other words, there should be no two robots, i and j, such that Ti∪Tj forms a (longer) path. Note that the agency does not care whether the number of robots being used is minimized as long as all the tasks are irreducible.

Your task in this problem is to count the number of feasible deployment plan given the town's layout. A plan is feasible if and only if it satisfies all the above-mentioned requirements.

For example, let N=6 and the roads are {(1,3),(2,3),(3,4),(4,5),(4,6)}. There are 5 feasible deployment plans as shown in the following figure.

Cleaning Robots(L)


·         The first plan uses 2 robots (labeled as A and B in the figure) to clean {1,2,3} and {4,5,6}.

·         The second plan uses 3 robots (labeled as A, B, and C in the figure) to clean {1,3,4,6}, {2}, and {5}.

·         The third plan uses 3 robots to clean {1,3,4,5}, {2}, and {6}.

·         The fourth plan uses 3 robots to clean {1}, {2,3,4,6}, and {5}.

·         The fifth plan uses 3 robots to clean {1}, {2,3,4,5}, and {6}.

No other plans are feasible in this case. For example, the plan {{1,3},{2},{4,5,6}} is not feasible as the task {1,3} and {2} can be combined into a longer path {1,3,2}. The plan {{1,2,3,4},{5},{6}} is also not feasible as {1,2,3,4} is not a path.

輸入

Input begins with a line containing an integer: N (1≤N≤100000) representing the number of junctions. The next N?1 lines each contains two integers: uiui vivi (1≤ui<vi≤N) representing a road connecting junction ui and junction vi. It is guaranteed that it is possible from one junction to go to any other junctions by going through one or more roads.

輸出

Output in a line an integer representing the number of feasible deployment plans. As this output can be large, you need to modulo the output by 1000000007.

樣例輸入
6
1 3
2 3
3 4
4 5
4 6
樣例輸出
5
提示
零基礎(chǔ)同學(xué)可以先學(xué)習(xí)視頻課程,包含C/C++、Python、百練、藍(lán)橋杯輔導(dǎo)、算法數(shù)據(jù)結(jié)構(gòu)等課程,提供視頻講解以及配套習(xí)題,還有老師答疑,點擊這里了解課程詳情

比賽公告

題號:2201,2202,2203,2204,2205,2206,2207,2208,2209,2210

點擊上方導(dǎo)航欄的訓(xùn)練,點擊題庫,尋找題號即可找到對應(yīng)題目,比賽結(jié)束后,請通過訓(xùn)練->題庫->尋找對應(yīng)題目的方式做題

因為不確定因素太多,就不再安排大家輪流講題了,大家做不出題可以在測試結(jié)束后去題庫找對應(yīng)的題目看題解,希望大家自覺練習(xí),認(rèn)真練習(xí),考核測試會采取不同與現(xiàn)在測試的方式,兩個月后綜合測試成績不達(dá)標(biāo)者會退出實驗室,希望大家認(rèn)真對待