大家是怎么实现斐波那契列数的? 1,1,2,3,5,8...f(n)=f(n-1) + f(n-2) 方法一: function f(n){ if(n == 1 || n == 0){ return 1; } return f(n-1) + f(n-2); } index.html 再给两种解法,对 ...
分类:
Web程序 时间:
2020-06-14 23:29:49
阅读次数:
100
结合中断上下文切换和进程上下文切换分析Linux内核的一般执行过程 一,实验目标 以fork和execve系统调用为例分析中断上下文的切换 分析execve系统调用中断上下文的特殊之处 分析fork子进程启动执行时进程上下文的特殊之处 以系统调用作为特殊的中断,结合中断上下文切换和进程上下文切换分析 ...
分类:
系统相关 时间:
2020-06-14 23:29:32
阅读次数:
52
题目 点这里看题目。 分析 首先不难想到可以枚举递增的序列,最后在答案里面乘上$n!$,于是有$O(nk)$的暴力 DP 一枚: $f(i,j)$表示长度为$i$、最大值$\le j$的序列的贡献和。 转移显然: \(f(i,j)=j\times f(i-1,j-1)+f(i,j-1)\) 那么可以 ...
分类:
其他好文 时间:
2020-06-14 23:25:01
阅读次数:
63
软件架构 基于spring-boot2.1.9.RELEASE、阿里云aliyun-sdk-oss3.7.0 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</ar ...
分类:
其他好文 时间:
2020-06-14 21:01:33
阅读次数:
77
//统计[1,100]之间的素数个数,并求和 #include <stdio.h> #include <math.h> #include <stdbool.h> bool isPrime(int ); int main() { int num; // scanf("%d", &num); int s ...
分类:
其他好文 时间:
2020-06-14 20:23:29
阅读次数:
76
n个人站一圈,数 1 2 1 2,数到1的出来,数到2 的继续保持一个圈。 输入 1 2 3 4 5 6 7 8 输出 1 3 5 7 2 6 4 8 #include<iostream> #include<queue> using namespace std; int main(){ int n, ...
分类:
其他好文 时间:
2020-06-14 19:06:04
阅读次数:
75
首先,导入一组数据,代码如下: import numpy as np import matplotlib.pyplot as plt x, y = [], [] for sample in open("../_Data/prices.txt", "r"): _x, _y = sample.split ...
分类:
其他好文 时间:
2020-06-14 18:59:39
阅读次数:
100
题目链接:https://codeforces.com/contest/1364/problem/B 题意 给出大小为 $n$ 的一个排列 $p$,找出子序列 $s$,使得 $|s_1-s_2|+|s_2-s_3|+\ldots+|s_{k-1}-s_k|$ 最大的同时 $k$ 尽可能地小。 题解 ...
分类:
其他好文 时间:
2020-06-14 18:48:20
阅读次数:
95
哈希表 思路 遍历数组arr,并用map记录各元素出现的次数 根据map的key把对应的value提出 并保存在数组val中。(KeySet()获取map中所有的key) 遍历排序后的数组val,同时与k比较,更新k的值 代码 //55ms public static int findLeastNu ...
分类:
其他好文 时间:
2020-06-14 17:01:04
阅读次数:
54
传送门 弱化版 考虑怎么从弱化版转化过来。 考虑通过树上路径修改和查询更新答案的本质——没错就是差分,我们把单点的信息搞到了一条路径上,那么我们就只要预先处理出每个点的基础贡献,然后就是在弱化版的基础上多乘一个整段区间的基础贡献和就好了。 那么这个单点的基础贡献是什么嘞?很简单,就是 \(dep_u ...
分类:
其他好文 时间:
2020-06-14 16:34:51
阅读次数:
59