Problem : Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any posit ...
分类:
移动开发 时间:
2020-03-29 22:38:14
阅读次数:
107
#include<iostream> #include<algorithm> #include<string> #include<cstring> #include<queue> using namespace std; int dx[]={0,0,1,-1}; int dy[]={1,-1,0,0 ...
分类:
其他好文 时间:
2020-03-29 12:46:37
阅读次数:
134
1、find使用 不同于map(map有find方法),vector本身是没有find这一方法,其find是依靠algorithm来实现的。 #include <iostream>#include <algorithm>#include <vector> int main(){ using name ...
分类:
其他好文 时间:
2020-03-29 12:32:51
阅读次数:
86
@[Toc] 什么是模板方法模式? 模板方法模式(Template Method Pattern)定义如下: Define the skeleton of an algorithm in an operation,deferring some steps to subclasses.Template ...
分类:
其他好文 时间:
2020-03-29 10:51:43
阅读次数:
90
头文件: 1.#include<algorithm> 2.功能:能找出最大值和最小值 3.使用方法: cout << "min: " << *(m1.first) << endl; cout << "max: " << *(m1.second) << endl; ...
分类:
其他好文 时间:
2020-03-29 01:35:47
阅读次数:
59
这道题只要求出点集的直径,答案就是直径的上取整一半 #include<iostream> #include<algorithm> #include<stack> #include<vector> #include<cstring> #include<cstring> #include<queue> ...
分类:
其他好文 时间:
2020-03-28 20:24:34
阅读次数:
65
一道线段树染色,但是这里是桶,我犯了经验主义以为是覆盖问题 数据不大,用二进制表示即可 #include<iostream> #include<algorithm> #include<stack> #include<vector> #include<cstring> using namespace ...
分类:
其他好文 时间:
2020-03-28 18:06:45
阅读次数:
64
"CF1328E Tree Queries" 应该还是比较妙的 题意 给你一个树,然后多次询问 每次询问给出一堆节点,问你是否能找到一个 从根出发的 链,是的对于给出的每个节点,都能找出链上的点,是的他们的距离小于等于$1$ $n\leq 2\cdot 10^5,m\leq 2\cdot 10^5, ...
分类:
其他好文 时间:
2020-03-28 01:22:14
阅读次数:
92
这个点的水可以从其他点来,也可以从0号结点来,所以把0号结点当成超级源点,然后跑最小生成树 #include <iostream> #include <cstdio> #include <queue> #include <algorithm> #include <cmath> #include <c ...
分类:
Web程序 时间:
2020-03-27 23:28:05
阅读次数:
198
#include <iostream> #include <deque> #include <algorithm> using namespace std; //deque构造函数 /* deque<T> deqT; //默认构造形式 deque(beg, end); //构造函数将[beg, en ...
分类:
其他好文 时间:
2020-03-27 21:49:44
阅读次数:
64