摘要:
x 和 y 的两座城市直接连通的前提是: x 和 y 的公因数中,至少有一个 严格大于 某个阈值 threshold; 给你两个整数 n 和 threshold ,以及一个待查询数组,请你判断每个查询 queries[i] = [ai, bi] 指向的城市 ai 和 bi 是否连通 1<n<1e4 阅读全文
摘要:
求这个灯管的发光样式种类,发光的部分需连在一起 思路 二进制枚举+检测连通,信誓旦旦地交了个69;事后发现建图的时候少建了一条边,分没了 #include<bits/stdc++.h> using namespace std; const int N=8; int vis[N], light[N]; 阅读全文