编程介的小学生 2019-01-01 10:06 采纳率: 20.5%
浏览 216
已采纳

无环图数据结构方面的计算问题,比较困难一些的用C语言,怎么计算

Problem Description
As we know, Tsuyuri Kumin likes sleeping in Eastest magical day sleep group's summer. But Rikka wants Kumin to play games with her. So she comes up with one problem:

Here is an undirected graph G with n vertices and m edges. Now you need to delete m−n edges and to make sure that the remain graph is connected. Rikka wants you to tell her the number of ways to choose the edges.

Kumin wants to go to sleep, so she asks you to answer this question. Can you help her?

Input
There are at most 100 testcases,and there are no more 5 testcases with n≥10.

For each test case, the first line contains two integers n,m (1≤n≤16,n≤m≤n(n−1)2).

Then m lines follows. Each of them contains two integers ui,vi, meaning that there is an edge between ui and vi. It is guaranteed that the graph doesn't contain self loops or multiple edges.

Output
For each testcase print a single integer - the number of ways to choose the edges. The answer may be very large, so you only need to print the answer modulo 998244353.

Sample Input
4 5
1 2
2 3
3 4
4 1
1 3

Sample Output
5

  • 写回答

1条回答 默认 最新

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

报告相同问题?

悬赏问题

  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 请求分析基于spring boot+vue的前后端分离的项目
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥20 为什么我写出来的绘图程序是这样的,有没有lao哥改一下
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥200 关于#c++#的问题,请各位专家解答!网站的邀请码
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么