摘要: Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 2469135 阅读全文
posted @ 2021-01-25 22:58 XA科研 阅读(117) 评论(0) 推荐(0) 编辑
摘要: A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the 阅读全文
posted @ 2021-01-25 21:13 XA科研 阅读(90) 评论(0) 推荐(0) 编辑
摘要: #include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #include<cmath> using namespace std; //全排列算法 求n的全排列以及排列个数 void perm(int a[], 阅读全文
posted @ 2021-01-25 15:11 XA科研 阅读(72) 评论(0) 推荐(0) 编辑
摘要: pair是一种将两个元素绑在一起的容器,需要使用头文件:#include<utility> 1.定义: pair<typename1,typename2> name; 初始化: pair<string,int>p("hahaha",5); 2.pair元素的访问 示例: #include<iostr 阅读全文
posted @ 2021-01-25 14:53 XA科研 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 一、queue queue为队列 定义:queue<typename> name; 常用函数为: (1)push() push(x):将x进行入队 (2)empty() 检测队列是否为空 (3)pop() 令队首元素出队 (4)size() 返回队列元素的个数 (5)front() , back() 阅读全文
posted @ 2021-01-25 14:39 XA科研 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 一、max() , min() , abs() max(x,y)和min(x,y)分别返回x和y的最大值和最小值,且参数必须是两个(可以是浮点数) 二、swap() swap(x,y)用来交换x和y的值 三、reverse() reverse(it,it2)可以将数组指针在(t,t2)之间的元素或容 阅读全文
posted @ 2021-01-25 14:16 XA科研 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 在C语言中,一般使用字符数组char str[]来存放字符串,但是使用字符数组有时会显得麻烦,C++在STL中加入了string类型,对字符串常用的需求功能进行了封装,使得操作起来更方便,且不易出错。 如果需要使用string ,需要添加string头文件,即#include<string> (注: 阅读全文
posted @ 2021-01-25 11:44 XA科研 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Synchronized Synchronized锁定类,锁住的是类字节码对象 总结: 1、 无论synchronized关键字加在方法上还是对象上,如果它作用的对象是非静态的,则它取得的锁是对象;如果synchronized作用的对象是一个静态方法或一个类,则它取得的锁是对类,该类所有的对象同一把 阅读全文
posted @ 2021-01-25 10:47 XA科研 阅读(59) 评论(0) 推荐(0) 编辑
摘要: dijkstra与prim比较: 两者算法思想类似,只不过前者收录的是路径上的点,后者收录的是树上的点 另外,如果图中出现很多相同边,很可能在prim所确定的树上,源点到其他点的距离不满足dijkstra的条件,即距离不是最短的。 比如下图这种情况: 若A为源点,红线所连为prim生成的最小生成树, 阅读全文
posted @ 2021-01-25 10:44 XA科研 阅读(403) 评论(0) 推荐(0) 编辑
摘要: 我相信 这两个月疯狂学习数学背单词和刷PAT的日子,将使我终生难忘 阅读全文
posted @ 2021-01-25 10:35 XA科研 阅读(29) 评论(0) 推荐(0) 编辑