CF1662C.European Trip
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The map of Europe can be represented by a set of n cities, numbered from 1 through n , which are connected by m bidirectional roads, each of which connects two distinct cities. A trip of length k is a sequence of k+1 cities v1,v2,…,vk+1 such that there is a road connecting each consecutive pair vi , vi+1 of cities, for all 1≤i≤k . A special trip is a trip that does not use the same road twice in a row, i.e., a sequence of k+1 cities v1,v2,…,vk+1 such that it forms a trip and vi=vi+2 , for all 1≤i≤k−1 .
Given an integer k , compute the number of distinct special trips of length k which begin and end in the same city. Since the answer might be large, give the answer modulo 998244353 .
输入格式
The first line contains three integers n , m and k ( 3≤n≤100 , 1≤m≤n(n−1)/2 , 1≤k≤104 ) — the number of cities, the number of roads and the length of trips to consider.
Each of the following m lines contains a pair of distinct integers a and b ( 1≤a,b≤n ) — each pair represents a road connecting cities a and b . It is guaranteed that the roads are distinct (i.e., each pair of cities is connected by at most one road).
输出格式
Print the number of special trips of length k which begin and end in the same city, modulo 998244353 .
输入输出样例
输入#1
4 5 2 4 1 2 3 3 1 4 3 2 4
输出#1
0
输入#2
4 5 3 1 3 4 2 4 1 2 1 3 4
输出#2
12
输入#3
8 20 12 4 3 6 7 5 7 8 2 8 3 3 1 4 7 8 5 5 4 3 5 7 1 5 1 7 8 3 2 4 2 5 2 1 4 4 8 3 6 4 6
输出#3
35551130
说明/提示
In the first sample, we are looking for special trips of length 2 , but since we cannot use the same road twice once we step away from a city we cannot go back, so the answer is 0 .
In the second sample, we have the following 12 special trips of length 3 which begin and end in the same city: (1,2,4,1) , (1,3,4,1) , (1,4,2,1) , (1,4,3,1) , (2,1,4,2) , (2,4,1,2) , (3,1,4,3) , (3,4,1,3) , (4,1,3,4) , (4,3,1,4) , (4,1,2,4) , and (4,2,1,4) .