思路: 首先把数组离散化,然后观察可以发现,在最优解中最终没有被移动过的那些数字一定是连续的,那么找到最长的连续的数字长度即可。 实现: ...
分类:
其他好文 时间:
2019-12-10 17:20:33
阅读次数:
125
对于分数$n/d$,其中$n,d$均为正整数,如果$n $$ \frac{1}{8},\frac{1}{7},\frac{1}{6},\frac{1}{5},\frac{1}{4},\frac{2}{7},\frac{1}{3},\frac{3}{8},\frac{2}{5},\frac{3}{7} ...
分类:
其他好文 时间:
2019-12-10 13:24:50
阅读次数:
62
原文 mysql主键不用自增数字的时候,可以参考如下方式,我抄来的。 -- 创建公共的序列表 DROP TABLE IF EXISTS t_common_sequence; CREATE TABLE t_common_sequence ( seq_name VARCHAR(100) NOT NULL ...
分类:
数据库 时间:
2019-12-10 11:39:33
阅读次数:
123
Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 1 ...
分类:
其他好文 时间:
2019-12-08 15:24:56
阅读次数:
84
题目:传送门 题意: 给你m个病毒串,只由(A、G、T、C) 组成, 问你生成一个长度为 n 的 只由 A、C、T、G 构成的,不包含病毒串的序列的方案数。 解: 对 m 个病毒串,建 AC 自动机, 然后, 这个AC自动机就类似于一张有向图, 可以用邻接矩阵存这张有向图。 最多10个病毒串, 每个 ...
分类:
其他好文 时间:
2019-12-08 10:25:46
阅读次数:
100
描述: 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。注意你不能在买入股票前卖出股票。 解答: 首先我们可以想到的使用暴力的方法,计算出每天买入和卖出股票所能够获得的最大的收益,找出所有收 ...
分类:
其他好文 时间:
2019-12-07 23:40:29
阅读次数:
146
一对多、多对一 Country类 @Entity @Table(name = "Country") public class Country { @Id //sequence identity @GeneratedValue(strategy = GenerationType.IDENTITY) p ...
分类:
编程语言 时间:
2019-12-07 19:35:56
阅读次数:
97
贪心 #include <iostream> #include<algorithm> #include<string.h> #include<set> using namespace std; const int maxn=100010; int ans[maxn]; int a[4]; void ...
分类:
其他好文 时间:
2019-12-07 17:57:19
阅读次数:
217
pip install django_miniprogram_api 1 报错 'gbk' codec can't decode byte xxxxx in position xxxx: illegal multibyte sequence 解决:删除readme.md 或者 在setup.py o ...