个人的理解: 要学会组织和分类数据,组织数据的时候 ,也就是组织各种各样的变量,封装打包好,最终实现的话多使用struct类型 ,代码看起来会漂亮好多。 ...
分类:
其他好文 时间:
2020-05-01 22:13:20
阅读次数:
53
http://acm.hdu.edu.cn/showproblem.php?pid=1002 代码 #include<iostream> #include<string> #include<cstring> #include<algorithm> struct bignum { int list[2 ...
分类:
其他好文 时间:
2020-05-01 20:15:31
阅读次数:
49
算法 最小生成树 思路 我们把每个点看成一个部落,每次取最小距离的两个抱团,同时部落也减少了一个....然后减减减,直到部落数==目标数,此时下一个不同部落的距离就是最短的距离! 代码 #include<iostream> #include<cstring> #include<algorithm> ...
分类:
Web程序 时间:
2020-05-01 18:49:02
阅读次数:
70
http://www.tzcoder.cn/acmhome/problemdetail.do?method=showdetail&id=4038 用bfs找出最短路,同时更新到该点的路径条数ans 用ans[i][j][f]表示i,j点f方向 f用0,1,2,3表示4个方向 同时和dx,dy数组联系 ...
分类:
其他好文 时间:
2020-05-01 15:05:30
阅读次数:
55
typedef struct { unsigned int count[2]; unsigned int state[4]; unsigned char buffer[64]; }MD5_CTX; #define F(x,y,z) ((x&y)|(~x&z)) #define G(x,y,z) (( ...
分类:
其他好文 时间:
2020-05-01 14:42:17
阅读次数:
66
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 5 using namespace std; 6 7 8 //解决约瑟夫环问题 9 //分别使用数组和链表 10 //问题描述:n只猴子围成一个圈选大王,从1开始数m个数 ...
分类:
其他好文 时间:
2020-05-01 12:53:52
阅读次数:
43
研究生复试题这么水的吗。。 根据合法距离得到所有合法边,跑一遍Kruscal以后判断所有点是不是有相同的祖先即可。 1 #include<iostream> 2 #include<algorithm> 3 #include<math.h> 4 #include<string.h> 5 using n ...
分类:
其他好文 时间:
2020-05-01 12:49:48
阅读次数:
57
1 #include <iostream> 2 #include <stdlib.h> 3 #define MAX_SIZE 4 4 using namespace std; 5 typedef int ElemType; 6 typedef struct sequeue{ 7 ElemType d ...
分类:
编程语言 时间:
2020-05-01 12:35:59
阅读次数:
62
已经建的边两个端点合并一下再跑Kruscal就好了 注意:cin会被卡 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 struct node{ 5 int from,to,w; 6 bool operator ...
分类:
其他好文 时间:
2020-05-01 12:20:31
阅读次数:
56
给定一个链表,两两交换其中相邻的节点,并返回交换后的链表。 你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。 示例: 给定 1->2->3->4, 你应该返回 2->1->4->3. 来源:力扣(LeetCode) 类似于链表反转,三个指针记录位置。 /** * Definition ...
分类:
其他好文 时间:
2020-05-01 00:42:44
阅读次数:
79