last

luogu 字符串口胡合集

懵懂的女人 提交于 2019-12-02 19:56:46
P3065 [USACO12DEC]第一!First! 建立trie树,对于每个字符串的每个字符,容易想到必定小于他的兄弟字符,用拓扑排序判断是否有冲突即可 P4070 [SDOI2016]生成魔咒 求S每个前缀有多少本质不同的子串 可知SAM每次加入一个字符后增加的本质不同的字符串是新增的结点maxlen[np] - minlen[np] + 1 = len[np] - len[fa[np]] #include<bits/stdc++.h> using namespace std; #define LL long long const int maxn = 1e5 + 10; int len[maxn << 1],fa[maxn << 1]; unordered_map<int,int> son[maxn << 1]; int size,last; void Init(){ size = last = 1; } int insert(int s){ int p = last,np= ++size; last = np; len[np] = len[p] + 1; for(;p && !son[p].count(s);p = fa[p]) son[p][s] = np; if(!p) fa[np] = 1; else{ int q = son[p][s]; if(len[p] +

STL源码剖析——算法#1 内存处理基本工具

落爺英雄遲暮 提交于 2019-12-02 18:41:39
  我们在学习序列式容器时,我们经常会遇到这三个函数:uninitialized_copy、uninitialized_fill、uninitialized_fill_n。在那时我们只是仅仅知道这些函数的功能,至于它们是如何实现的,我们并没有深究。在这节,我们花点时间摘下这几个函数的面具,看看它们不为人知的那一面。 uninitialized_copy   函数签名: 1 template <class InputIterator, class ForwardIterator> 2 inline ForwardIterator 3 uninitialized_copy(InputIterator first, InputIterator last, 4 ForwardIterator result)   该函数一般用于在内存配置与对象构造分离的情况,例如vector,vector一般配置比所需元素个数更大的空间,那么在备用空间中放入新元素,就是uninitialized_copy该做的事。换句话说,如果作为输出目的地的 [ result, result+(last-first) ) 范围内的每一个迭代器都指向未初始化的区域,则uninitialized_copy() 会使用复制构造函数,把来自 [ first, last ) 范围的每一个对象产生一份复制品,放进输出范围中

[LC] 150. Evaluate Reverse Polish Notation

风流意气都作罢 提交于 2019-12-02 18:19:06
Evaluate the value of an arithmetic expression in Reverse Polish Notation . Valid operators are + , - , * , / . Each operand may be an integer or another expression. Note: Division between two integers should truncate toward zero. The given RPN expression is always valid. That means the expression would always evaluate to a result and there won't be any divide by zero operation. Example 1: Input: ["2", "1", "+", "3", "*"] Output: 9 Explanation: ((2 + 1) * 3) = 9 Example 2: Input: ["4", "13", "5", "/", "+"] Output: 6 Explanation: (4 + (13 / 5)) = 6 Example 3: Input: ["10", "6", "9", "3", "+", "

1046. Last Stone Weight

送分小仙女□ 提交于 2019-12-02 15:08:04
We have a collection of rocks, each rock has a positive integer weight. Each turn, we choose the two heaviest rocks and smash them together. Suppose the stones have weights x and y with x <= y. The result of this smash is: If x == y, both stones are totally destroyed; If x != y, the stone of weight x is totally destroyed, and the stone of weight y has new weight y-x. At the end, there is at most 1 stone left. Return the weight of this stone (or 0 if there are no stones left.) Example 1: Input : [ 2 , 7 , 4 , 1 , 8 , 1 ] Output : 1 Explanation : We combine 7 and 8 to get 1 so the array converts

无法下载goproxy

泪湿孤枕 提交于 2019-12-02 12:49:29
手动安装 #!/bin/bash F=“proxy-admin_linux-amd64.tar.gz” cd /tmp rm -rf F L A S T V E R S I O N = F LAST_VERSION= F L A S T V ​ E R S I O N = (curl --silent “https://api.github.com/repos/snail007/proxy_admin_free/releases/latest” | grep -Po ‘“tag_name”: “\K.*?(?=”)’) wget “https://github.com/snail007/proxy_admin_free/releases/download/ L A S T V E R S I O N / {LAST_VERSION}/ L A S T V ​ E R S I O N / F” #install tar zxvf $F chmod +x proxy-admin ./proxy-admin uninstall >/dev/null 2>&1 ./proxy-admin install rm $F systemctl status proxyadmin & sleep 1 echo “install done, please visit : http://YOUR_IP

STL源码剖析——序列式容器#2 List

妖精的绣舞 提交于 2019-12-02 11:49:32
  list就是链表的实现,链表是什么,我就不再解释了。list的好处就是每次插入或删除一个元素,都是常数的时空复杂度。但遍历或访问就需要O(n)的时间。   List本身其实不难理解,难点在于某些功能函数的实现上,例如我们会在最后讨论的迁移函数splice()、反转函数reverse()、排序函数sort()等等。 list的结点   设计过链表的人都知道,链表本身和链表结点是不一样的结构,需要分开设计,这里的list也不例外,以下是STL list的结点结构: 1 template <class T> 2 struct __list_node { 3 typedef void* void_pointer; 4 void_pointer next; 5 void_pointer prev; 6 T data; 7 };   从结点结构可以看出,list是一个双向链表,有指向前一结点的prev指针,指向下一结点的next指针。 list的迭代器   显然,list的迭代器本身是什么类型早已由其本身的数据结构所决定,list的双向链表,不支持随机存取,只能是双向迭代器(Bidirectional Iterators)。另外,list的迭代器应该支持正确的递增、递减、取值、成员取用等操作。   以下是list迭代器的源码: 1 template<class T, class Ref,

从零开始学习前端开发 — 11、CSS3选择器

送分小仙女□ 提交于 2019-12-02 11:20:40
一、基本选择器 1.* 通配符(通用选择器) 2.id选择器 3.class选择器(类选择器) 4.标签选择器(元素选择符) 5.群组选择器 (选择符1,选择符2{...}) 二、层次选择器(关系选择器) 1.后代选择器 语法: E F eg: .box a{color:red;}   匹配.box中所有的子元素a 2.子代选择器 语法: E>F eg: .box>a{color:red;}   匹配.box中第一级子元素a 3.相邻兄弟选择器 语法: E F eg: .box h3{background:pink;}   匹配.box后面紧邻的那一个h3元素 注:相邻兄弟选择器能匹配到的元素有且仅有一个,并且是E元素后面紧邻的F元素 4.通用兄弟选择器 语法: E~F eg: .box~h3{border:2px solid blue;}   匹配.box后面所有兄弟元素h3 注:通用兄弟选择器可以匹配到多个其后的兄弟元素 三、动态伪类选择器 1.E:link 链接没有被访问过时的状态 2.E:visited 链接访问过后的状态 3.E:hover 鼠标滑过时的状态 4.E:active 鼠标按下时的状态 (爱恨原则: L o V e HA te) 5.E:focus 当获取到焦点时的状态 eg: input:focus{border:2px solid red;} 当获取焦点时

Jmeter聚合报告生成图表

扶醉桌前 提交于 2019-12-02 11:02:10
背景 最近在帮别的项目组执行性能测试,使用的工具是Jmeter。接口录制和参数化前一个人已经做好了,我主要的工作就是执行脚本,撰写测试报告。事情并不复杂,可做起来却极为耗时。 首先,由于有6组账号,分别对应6个不同的BU,而每个BU又需要执行1、10、20、30四种压力模式。如果使用GUI模式跑,就需要执行24次,还需要每次自己改参数,实在是费心费力。 其次,使用Jmeter插件生成聚合结果后,要根据结果出一份报告,。在我之前做的同事,由于是第一轮测试,也就无从比较,只是从接口、页面、错误率三个维度写了一份报告。而我则需要根据本次和上次的结果,生成图表,以便直观地展示结果。刚开始做这件事时,我是根据需求,找到对应的接口和页面,分别挪到Excel里,利用Excel生成图表。可是既容易错,还容易瞎,实在是折磨人。 解决方案 1 为了解决第一个问题,我的思路是找到Jmeter测试脚本的配置文件,复制多份,批量改成不同的配置,再利用bat脚本每次执行多个。 先将原来的测试脚本Jmx文件复制多份,按环境分成不同的文件夹,再按线程数整理进去,如下图: 因为Jmx文件其实都是xml格式,里面存储了脚本的配置,于是就使用VS Code打开文件夹,进行批量替换,这样很快就能完成配置工作。 之后再写bat脚本,以命令行模式执行jmx脚本,并生成测试报告。 注意在批处理文件中执行多条命令时

fastjson对json解析

巧了我就是萌 提交于 2019-12-02 10:33:24
json数据:{ "devices": { "cameras": { "device_id": "awJo6rH", "last_event": { "has_sound": true, "has_motion": true, "has_person": true, "start_time": "2016-12-29T00:00:00.000Z", "end_time": "2016-12-29T18:42:00.000Z" } } } 解析json val jsonObject = JSON.parseObject(json) val lastEvent = jsonObject.getJSONObject("devices") .getJSONObject("cameras") .getJSONObject("last_event") val hasPerson = lastEvent.getString("has_person") val startTime = lastEvent.getString("start_time") (startTime,hasPerson) }).toDF("startTime","hasPerson") 来源: https://blog.csdn.net/yilushunfengli/article/details/102752786

jqPaginator 分页插件

放肆的年华 提交于 2019-12-02 08:24:39
github地址 < ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > < html xmlns = "http://www.w3.org/1999/xhtml" > < head > < title > < / title > < link href = "res/bootstrap.min.css" rel = "stylesheet" type = "text/css" / > < script src = "res/jquery-1.7.2.min.js" type = "text/javascript" > < / script > < script src = "res/jqPaginator.min.js" type = "text/javascript" > < / script > < / head > < body > < div > < ul class = "pagination" id = "pagination" > < / ul > < / div > < / body > < script > $ ( function ( ) { $ .