CF11D.A Simple Task

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices or edges.

给定一个简单图,输出其中简单环的数量。简单环是指不包含重复顶点或重复边的环。

输入格式

The first line of input contains two integers n and m (1 ≤ n ≤ 19, 0 ≤ m) – respectively the number of vertices and edges of the graph. Each of the subsequent m lines contains two integers a and b, (1 ≤ a, b ≤ n, a ≠ b) indicating that vertices a and b are connected by an undirected edge. There is no more than one edge connecting any pair of vertices.

输入的第一行包含两个整数 nn 和 mm(1 ≤ n ≤ 191 ≤ n ≤ 19,0 ≤ m0 ≤ m),分别表示图的顶点数和边数。接下来的 mm 行中,每行包含两个整数 aa 和 bb(1 ≤ a, b ≤ n1 ≤ a,\,b ≤ n,a ≠ ba ≠ b),表示顶点 aa 和 bb 之间存在一条无向边。任意一对顶点之间至多只有一条边。

输出格式

Output the number of cycles in the given graph.

输出给定图中环的数量。

输入输出样例

  • 输入#1

    4 6
    1 2
    1 3
    1 4
    2 3
    2 4
    3 4

    输出#1

    7

说明/提示

The example graph is a clique and contains four cycles of length 3 and three cycles of length 4.

示例图是一个团,包含四个长度为 3 的环和三个长度为 4 的环。

输入解题思路,AI测评打分。不知道怎么写?

首页