比赛链接:https://codeforces.com/contest/1433 A. Boring Apartments 题解 模拟即可. 代码 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { int n; cin >> n; int ans =…
题目链接:https://codeforces.com/contest/1433/problem/G 题解 跑 \(n\) 遍 \(dijkstra\) 得到任意两点间的距离,然后枚举哪一条边权为 \(0\) 即可. 代码 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, k; cin >> n >…
F. Zero Remainder Sum || dp #include <cstdio> #include <algorithm> #include <cstring> using namespace std; const int maxn = 73; int a[maxn][maxn], dp[maxn][maxn][maxn][maxn], d[maxn][maxn]; int main() { int n, m, k; scanf("%d %d %d&…