代码改变世界

并查集和带权并查集

2017-04-26 00:07 by roffen, 2388 阅读, 0 推荐, 收藏, 编辑
摘要:这两天做了几道并查集的题目,hdu的联通工程啊more is better 啊,然后卡在hdu1829,带权的并查集,没搞懂,尝试写下来让思路清晰些。 并查集是一种维护不同集合,在此基础上实现快速判断,统计个数等等的算法。 基础的有find和join两个功能,其中join作用于接收新数据。 并查集应 阅读全文

算法学习之路(2)

2016-12-13 21:29 by roffen, 169 阅读, 0 推荐, 收藏, 编辑
摘要:这段时间学到了快速幂,贪心,不过仅仅是知晓而已 学到了链表结构,和在algorithm库里的sort函数,functional里的great<type>()的使用 #include<iostream>#include<algorithm>#include<functional>#include<cm 阅读全文

算法学习之路(1)

2016-12-02 15:01 by roffen, 198 阅读, 0 推荐, 收藏, 编辑
摘要:#include<iostream>#include<iomanip>#include "string.h"#include<cstdio>#include<cmath>#include<time.h>using namespace std;/*int main(){ int a, b; while 阅读全文

c艹学习之路(2)---函数,递归,穷举

2016-11-09 19:55 by roffen, 281 阅读, 0 推荐, 收藏, 编辑
摘要:11.9 /*#include<iostream>#include<cmath>#include<iomanip>using namespace std;int judge(double side1, double side2);int main(){ cout << "side1\t" << "s 阅读全文

c艹学习之路(1)循环

2016-09-25 20:03 by roffen, 174 阅读, 0 推荐, 收藏, 编辑
摘要:#include<iostream>using namespace std;int main()/*{ int i=1,j=0;//while循环 while(i<=10) { j+=i; i++; } cout<<j<<endl; int i=1,j=0;//do...while循环 do { j 阅读全文

python学习之路(1)

2016-08-26 18:37 by roffen, 126 阅读, 0 推荐, 收藏, 编辑
摘要:1.了解python的基本模块和功能: 数据类型 基本模型:列表,元组,字典,set,条件(if elif else),循环(while, for x in y:),以及一些零碎的语法(range,print,) 2.下载和运行python3,下载了在线助手以在网络上运行,下载了notepad++文 阅读全文