一、获取当前日期工具类 DateUtil.java package com.atguigu.staservice.sched; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.text.DateFormat; ...
分类:
其他好文 时间:
2021-04-22 15:17:48
阅读次数:
0
1.记录索引交换 class Solution { public: int minSwapsCouples(vector<int>& row) { int len=row.size(); vector<int> idx(len,-1); int ret=0; for(int i=0;i<len;++ ...
分类:
其他好文 时间:
2021-04-22 15:12:46
阅读次数:
0
并查集可以有两个优化方案, 1,平衡性优化:对每个结点标记一个重量值,在进行union操作时,将重量小的添加到重量大的节点上。 2,路径压缩:在进行find操作时,顺便对路径进行压缩 private int find(int x) { while (parent[x] != x) { // 进行路径 ...
分类:
其他好文 时间:
2021-04-22 15:12:28
阅读次数:
0
根据完全二叉树的性质(编号为$u$的节点的左儿子编号为$u2$,右儿子编号为$u2+1$),并利用后序遍历进行递归建树。 $level[i]$存储编号为$i$的节点的值。 const int N=35; int post[N]; int level[N]; int n; int k; void df ...
分类:
其他好文 时间:
2021-04-21 12:54:57
阅读次数:
0
EstimateAffine2D用法 OpenCV官方帮助 cvMat cvestimateAffine2D(InputArray from, InputArray to, OutputArray inliers = noArray(), int method = RANSAC, double ra ...
分类:
其他好文 时间:
2021-04-21 12:41:44
阅读次数:
0
总的来说,replace into 跟 insert into 功能类似 不同点在于:replace into 首先尝试插入数据到表中 1. 如果发现表中已经有此行数据(根据主键或者唯一索引判断)则先删除此行数据,然后插入新的数据。 2. 否则,直接插入新数据。 要注意的是:插入数据的表必须有主键或 ...
分类:
其他好文 时间:
2021-04-21 12:34:55
阅读次数:
0
滚动数组: 若要求斐波那契数列第n项(n>=2),F(0)=1,F(1)=1,F(n)=F(n-1)+F(n-2) 因为每一步的递推只与前2步有关,所以只需要记录前2步的方案数,用滚动数组的话,就不需要开多余的空间。 1 int f[3]; 2 f[0] = 1; 3 f[1] = 1; 4 cin ...
分类:
其他好文 时间:
2021-04-21 12:28:25
阅读次数:
0
堆排序 public class HeapSort { public static void main(String[] args) { int[] arr = {1, 3, 519, 2, 10, 8, 0, 998}; heapSort(arr); System.out.println(Arra ...
分类:
编程语言 时间:
2021-04-21 12:26:45
阅读次数:
0
def selfAdd(a): a += a a_int = 1 print('a_int1:',a_int) selfAdd(a_int) print('a_int2:',a_int) 输出结果: a_int1: 1 a_int2: 1 a_list =[1,2] print('a_list1:' ...
分类:
其他好文 时间:
2021-04-21 12:25:48
阅读次数:
0
1,基本数据类型 定义 :4类8种: 数值型: 整数型Byte,short ,int ,long 浮点数类型:float,double 布尔类型:boolean 引用数据类型:string 获取取值范围 注意点 2,数据之间的转换 ctrl+1提示错误 分类 1.自动转换(隐式类型转换) 小-》大 ...
分类:
编程语言 时间:
2021-04-21 12:25:03
阅读次数:
0