1. ls命令 ls /etc -l //以列表形式查看etc文件夹中内容 2. cd、pwd命令 1 cd /etc/network/ //定位到network文件夹中 2 cd . //当前目录 3 cd .. //上级目录 4 pwd //显示当前目录路径 3. cat、dmesg、watch ...
分类:
系统相关 时间:
2020-04-20 21:56:14
阅读次数:
76
// method 1 public static int majorityElement_1(int[] num) { int major=num[0], count = 1; for (int i=1; i<num.length;i++) { if (count == 0) { count++; ...
分类:
编程语言 时间:
2020-04-20 15:30:23
阅读次数:
89
题目链接 题目描述 给你一棵有n个结点的树,节点编号为1~n。 每个节点都有一个权值。 要求执行以下操作: U V K:求从节点u到节点v的第k小权值。 Solution 树上主席树裸题。 思路和序列差不多,树上前缀和即可。 可持久化时的前一个版本就是它的父亲。 设查询(u,v),值就是u+v-lc ...
分类:
其他好文 时间:
2020-04-20 11:43:26
阅读次数:
63
问题 描述: 将一组整数输入到数组p,输出p从小到大的全排列,p的元素可重叠 代码描述: 1 //从小到大可重排列 2 #include<stdio.h> 3 int A[20]; 4 int p[20]; 5 int n; 6 7 void sort(int n,int *p) 8 { 9 for ...
分类:
编程语言 时间:
2020-04-19 13:14:45
阅读次数:
77
高阶函数 函数在Python中是一等公民 函数也是对象,可调用的对象 函数可以作为普通变量,参数,返回值等 成为高阶函数的必要条件: 接收一个或多个函数作为参数 输出一个函数 示例: def counter(base): def inc(step=1): nonlocal base base += ...
分类:
编程语言 时间:
2020-04-18 23:15:21
阅读次数:
130
1005 继续(3n+1)猜想 (25分) 卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。 当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。 例如对 n=3 进行验证的时候,我们需要计算 3、5、8、4、2、1,则当我们对 ...
分类:
编程语言 时间:
2020-04-18 23:02:40
阅读次数:
63
1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn=5000+50; 5 int ansx[maxn]; 6 int ansy[maxn]; 7 int visx[maxn ...
分类:
其他好文 时间:
2020-04-18 20:12:05
阅读次数:
64
插入排序(英语:Insertion Sort)是一种简单直观的排序算法。它的工作原理是通过构建有序序列,对于未排序数据,在已排序序列中从后向前扫描,找到相应位置并插入。插入排序在实现上,在从后向前扫描过程中,需要反复把已排序元素逐步向后挪位,为最新元素提供插入空间。 1 def insert_sor ...
分类:
编程语言 时间:
2020-04-18 18:58:39
阅读次数:
66
1 void selectSort(int array[], int n) { 2 int current; 3 for (current = 0; current < n; ++current) { 4 int i, min = array[current], minIndex = current ...
分类:
编程语言 时间:
2020-04-18 11:37:00
阅读次数:
49
Problem : You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can ...
分类:
其他好文 时间:
2020-04-18 10:09:19
阅读次数:
67