编程介的小学生 2019-04-27 21:47 采纳率: 20.5%
浏览 232

稳定性的计算的一个算法的问题,怎么利用C语言的程序的设计的办法的思路去实现?

Problem Description
Long long ago, there was a prosperous kingdom which consisted of n cities and every two cites were connected by an undirected road.

However, one day a big monster attacked the kingdom and some roads were destroyed. In order to evaluate the influence brought by the catastrophe, the king wanted to know the instability of his kingdom. Instability is defined as the number of the unstable subset of {1, 2,⋯,n}.

A set S is unstable if and only if there exists a set A such that A⊆S(|A|≥3) and A is a clique or an independent set, namely that cites in A are pairwise connected directly or they are pairwise disconnected.

Archaeologist has already restored themroads that were not destroyed by the monster. And they want you to figure out the instability.

Since the answer may be tremendously huge, you are only required to write a program that prints the answer modulo 1000000007.

Input
The first line contains only one integer T, which indicates the number of test cases.

For each test case, the first line contains two integers n (3≤n≤50) and m (1≤m≤n(n−1)/2), indicating the number of cities and the number of roads.

Then the following are m lines, each of which contains two integers x and y, indicating there is a road between the city x and the city y.

It is guarenteed that there does not exist a road connecting the same city and there does not exist two same roads.

Output
For each test case, print a line “Case #x: y”, where x is the case number (starting from 1) and y is an integer indicating the instability modulo 1000000007.

Sample Input
2
4 3
1 2
2 3
1 3
3 0

Sample Output
Case #1: 2
Case #2: 1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Matlab问题解答有两个问题
    • ¥50 Oracle Kubernetes服务器集群主节点无法访问,工作节点可以访问
    • ¥15 LCD12864中文显示
    • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
    • ¥15 gsoap生成onvif框架
    • ¥15 有关sql server business intellige安装,包括SSDT、SSMS。
    • ¥15 stm32的can接口不能收发数据
    • ¥15 目标检测算法移植到arm开发板
    • ¥15 利用JD51设计温度报警系统
    • ¥15 快手联盟怎么快速的跑出建立模型