最后
针对最近很多人都在面试,我这边也整理了相当多的面试专题资料,也有其他大厂的面经。希望可以帮助到大家。
上述的面试题答案都整理成文档笔记。 也还整理了一些面试资料&最新2021收集的一些大厂的面试真题(都整理成文档,小部分截图)
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
输出格式
输入输出样例
输入 1
2
2
1 2 1
1 2 0
2
1 2 1
2 1 1
输出 1
NO
YES
输入 2
2
3
1 2 1
2 3 1
3 1 1
4
1 2 1
2 3 1
3 4 1
1 4 0
输出 2
YES
NO
说明/提示
解题代码:
#include<stdio.h>
#include
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include
using namespace std;
int t,n;
int f[100010],book[1000007*3];
struct node{
int x,y,e;
}d[1000001];
bool cmp(node a,node b){ //排序
return a.e > b.e;
}
void init(int xx){ //初始化
for(int i=1;i<=xx;i++) f[i] = i;
}
int find(int x){ //查找
if(x == f[x]) return x;
return f[x] = find(f[x]);
}
void merge(int x,int y){ //合并
if(find(x) != find(y))
f[find(x)] = find(y);
}
int main(){
cin>>t;
while(t–){
最后
给大家送一个小福利
附高清脑图,高清知识点讲解教程,以及一些面试真题及答案解析。送给需要的提升技术、准备面试跳槽、自身职业规划迷茫的朋友们。