4199. 公约数 - AcWing题库 def gcd(a,b): while b: a,bb,a%b return a def init_divisors(a,b): dgcd(a,b) i1 while i*i<d: if d%i0: ans.append(i) if i!d//i:ans.append(d//i) i1 ans.so…
kruskal做法(加边)
#include <bits/stdc.h>
using namespace std;
int x[10005],y[10005],z[10005];//存储i点的x与y坐标
int bcj[10005];//并查集
struct Edge{//边 int v1,v2; double w;
}edge[2000005];
int cmp(Edge a, Edge b){return a.w < b.w;}
int find(i…