本文主要是介绍“今日头条杯”首届湖北省大学程序设计竞赛-D. Who killed Cock Robin,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
链接:https://www.nowcoder.com/acm/contest/104/C
来源:牛客网
空间限制:C/C++ 262144K,其他语言524288K
64bit IO Format: %lld
题目描述
Who killed Cock Robin?
I, said the Sparrow, With my bow and arrow,I killed Cock Robin.
Who saw him die?
I, said the Fly.With my little eye,I saw him die.
Who caught his blood?
I, said the Fish,With my little dish,I caught his blood.
Who'll make his shroud?
I, said the Beetle,With my thread and needle,I'll make the shroud.
.........
All the birds of the air
Fell a-sighing and a-sobbing.
When they heard the bell toll.
For poor Cock Robin.
March 26, 2018
Sparrows are a kind of gregarious animals,sometimes the relationship between them can be represented by a tree.
The Sparrow is for trial, at next bird assizes,we should select a connected subgraph from the whole tree of sparrows as trial objects.
Because the relationship between sparrows is too complex, so we want to leave this problem to you. And your task is to calculate how many different ways can we select a connected subgraph from the whole tree.
输入描述:
The first line has a number n to indicate the number of sparrows.
The next n-1 row has two numbers x and y per row, which means there is an undirected edge between x and y.
输出描述:
The output is only one integer, the answer module 10000007 (107+7) in a line
这篇关于“今日头条杯”首届湖北省大学程序设计竞赛-D. Who killed Cock Robin的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!