int n, m; cin >> n >> m; vector< vector< int > > d(105, vector< int > (105)); while (m -- ) { int u, v; cin >> u >> v; d[u][v] = d[v][u] = true; } int ans = 0; for (int i = 1; i <= n; ++ i) { for (int j = i + 1; j <= n; ++ j) { for (int k = j + 1; k <= n; ++ k) { if (d[i][j] && d[j][k] && d[i][k]) { ++ ans; } } } } cout << ans << '\n'; return0; }
#include<bits/stdc++.h> usingnamespace std; using LL = longlong; constint N = 2e5 + 5, MOD = 998244353, INF = 0x3f3f3f3f;
constexprint P = 998244353; using i64 = longlong; // assume -P <= x < 2P intnorm(int x){ if (x < 0) { x += P; } if (x >= P) { x -= P; } return x; } template<class T> T power(T a, i64 b){ T res = 1; for (; b; b /= 2, a *= a) { if (b % 2) { res *= a; } } return res; } structZ { int x; Z(int x = 0) : x(norm(x)) {} Z(i64 x) : x(norm(x % P)) {} intval()const{ return x; } Z operator-() const { returnZ(norm(P - x)); } Z inv()const{ assert(x != 0); returnpower(*this, P - 2); } Z &operator*=(const Z &rhs) { x = i64(x) * rhs.x % P; return *this; } Z &operator+=(const Z &rhs) { x = norm(x + rhs.x); return *this; } Z &operator-=(const Z &rhs) { x = norm(x - rhs.x); return *this; } Z &operator/=(const Z &rhs) { return *this *= rhs.inv(); } friend Z operator*(const Z &lhs, const Z &rhs) { Z res = lhs; res *= rhs; return res; } friend Z operator+(const Z &lhs, const Z &rhs) { Z res = lhs; res += rhs; return res; } friend Z operator-(const Z &lhs, const Z &rhs) { Z res = lhs; res -= rhs; return res; } friend Z operator/(const Z &lhs, const Z &rhs) { Z res = lhs; res /= rhs; return res; } friend std::istream &operator>>(std::istream &is, Z &a) { i64 v; is >> v; a = Z(v); return is; } friend std::ostream &operator<<(std::ostream &os, const Z &a) { return os << a.val(); } }; int n, m, k; int deg[N]; Z inv[N], fac[N], finv[N]; voidPre_Work(){ fac[0] = fac[1] = 1; inv[1] = 1; finv[0] = finv[1] = 1; for(int i = 2; i < N; ++ i) { fac[i] = fac[i - 1] * i; inv[i] = MOD - MOD / i * inv[MOD % i]; finv[i] = finv[i - 1] * inv[i]; } } Z C(int x, int y){ if (x < y) return0; return fac[x] * finv[x - y] * finv[y]; } signedmain(){ cin.tie(nullptr)->sync_with_stdio(false);
Pre_Work(); cin >> n >> m >> k; for (int i = 1; i <= m; ++ i) { int u, v; cin >> u >> v; ++ deg[v]; ++ deg[u]; } vector< int > cnt(2); for (int i = 1; i <= n; ++ i) { ++ cnt[deg[i] & 1]; } Z ans = 0; if (k & 1) { for (int i = 1; i <= k; i += 2) { ans += C(cnt[0], i) * C(cnt[1], k - i); } } else { for (int i = 0; i <= k; i += 2) { ans += C(cnt[0], i) * C(cnt[1], k - i); } } cout << ans << '\n'; return0; }