编程介的小学生 2017-09-27 14:46 采纳率: 20.5%
浏览 672
已采纳

RootedTree

Problem Description
There are n nodes, you should write a program to calculate how many way to form a rooted tree. This tree must satisfy two following conditions:
1: This tree should contain all the n nodes.
2: The size of subtree whose root is node i, should be from li to ri.
Give you li and ri, you should output the answer.

Input
There are several cases, First is the number of cases T. (There are most ten cases).
For each case, in the first line is a integer n (1≤n≤14). In following n line, each line has two integers li,ri(1≤li≤ri≤n).

Output
For each case output the answer modulo 109+7.

Sample Input
2
3
1 3
1 3
1 3
3
1 1
2 2
3 3

Sample Output
9
1

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-10-15 15:50
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败