编程介的小学生 2017-06-10 08:30 采纳率: 20.5%
浏览 808
已采纳

Permutation

Problem Description
bobo has a permutation p1,p2,…,pn of 1,2,…,n.

Knowing m extra constraints of form pai<pbi, bobo wanna count the number of different permutations modulo (109+7).

It is guaranteed that there is at least one such permutation.

Input
The input consists of several tests. For each tests:

The first line contains n,m (1≤n≤40,0≤m≤20). Each of the following m lines contain 2 integers ai,bi(1≤ai,bi≤n).

Output
For each tests:

A single number denotes the number of permutations.

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

Sample Output
3
1

  • 写回答

1条回答

  • devmiao 2017-06-28 16:36
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 我想在一个软件里添加一个优惠弹窗,应该怎么写代码
  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流