1 条题解
-
0
C++ :
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, m, x, y, cnt[N]; int main() { cin >> n >> m; while (m--) { cin >> x >> y; cnt[x]++; cnt[y]++; } long long s = 0; for(int i = 1; i <= n; i++){ s += 1ll * cnt[i] * (cnt[i] - 1) / 2; } cout << s; }
- 1
信息
- ID
- 5619
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者