1.深度优先遍历 void dfs(Graph G,int i) { visted[i] = 1; for (int j = 0; i < G.vex; j++) { if (G.arcs[i][j]==1&&visted[j]!=1) { dfs(j); } } } 2.广度优先遍历 void b ...
分类:
其他好文 时间:
2020-08-18 13:20:00
阅读次数:
51
dp[i] = max_{j ∈ [i-R,i-L]}( dp[j] + v(j+1,i) )。做前缀和后,对每种s[j]的值,开一个单调队列。每次将i-L入队、将i-R-1出队。用线段树维护每个队列的队首。转移时最区间最大值查询。 ...
分类:
其他好文 时间:
2020-08-17 16:57:59
阅读次数:
68
do.sh #!/bin/bash repeat() { while :; do $@ && return; sleep 1; done } retryuntil() { echo $(date +%F%n%T) msg=`./job.sh 2>&1` echo $msg #echo "$msg" ...
分类:
其他好文 时间:
2020-08-13 22:08:35
阅读次数:
50
首先取出这个项链的长度x,如果他是回文数的话让项链减去一半,x减去一半,如果他不是回文数,就退出循环 上代码: #include <iostream>#include <cstdio>#include <cmath>#include <cstring>#include <algorithm>#inc ...
分类:
其他好文 时间:
2020-08-13 12:13:39
阅读次数:
53
JAVA: public final boolean isHappy(int n) { int next = next(n); while (n != 1 && n != next) { n = next(n); next = next(next(next)); } return n == 1; } ...
分类:
其他好文 时间:
2020-08-12 15:41:43
阅读次数:
51
变量: 系统变量:全局变量、会话变量 自定义变量:用户变量、局部变量 一、系统变量 说明:变量由系统提供,不是用户定义,属于服务器层面 语法 1、查看所有的系统变量 show global | [session] variables; 2、查看满足条件的部分系统变量 show global |【se ...
分类:
其他好文 时间:
2020-08-12 14:04:56
阅读次数:
74
以下是skynet源码:structgroupnode{inthandle;structskynetcontextctx;structgroupnodenext;};structgroup{intlock;structgroupnodenode[HASHSIZE];};structgroupG=NULL;inlinestaticvoidlock(structgroupg){while(synclo
分类:
Web程序 时间:
2020-08-11 17:32:26
阅读次数:
90
Leetcode.76 Minimum Window Substring Given a string S and a string T, find the minimum window in S which will contain all the characters in T in compl ...
分类:
编程语言 时间:
2020-08-11 15:56:40
阅读次数:
64
package com.xuyifan.struct; /** * @author xyf * @create 2020-08-11-11:08 */ /** for循环最先执行初始化步骤,可以声明一种类型,但是可以初始化一个或多个初始化变量 也可以是空语句 检测布尔表达式的值,如果为true,则循 ...
分类:
其他好文 时间:
2020-08-11 13:06:35
阅读次数:
82