test

Codeforces C. Adding Powers

放肆的年华 提交于 2020-03-11 02:00:25
C. Adding Powers Suppose you are performing the following algorithm. There is an array v 1 , v 2 , … , v n v1,v2,…,vn filled with zeroes at start. The following operation is applied to the array several times — at i i-th step ( 0 0-indexed) you can: either choose position p o s pos ( 1 ≤ p o s ≤ n 1≤pos≤n) and increase v p o s vpos by k i ki; or not choose any position and skip this step. You can choose how the algorithm would behave on each step and when to stop it. The question is: can you make array v v equal to the given array a a ( v j = a j vj=aj for each j j) after some step? Input The

linux 7 关闭透明大页

白昼怎懂夜的黑 提交于 2020-03-11 01:17:30
如题,关闭透明大页 推荐方式是 vi /etc/rc.local 添加如下内容 if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabled fi if test -f /sys/kernel/mm/transparent_hugepage/defrag; then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi 保存后 chmod +x /etc/rc.d/rc.local 重启 来源: CSDN 作者: made-in-china 链接: https://blog.csdn.net/huoshuyinhua/article/details/104778954

Spring Boot 2.x 实战--第一个Spring Boot程序

安稳与你 提交于 2020-03-11 00:23:04
Spring Boot 2.x 实战--第一个Spring Boot程序 《Spring Boot 2.X 实战》系列文章将分为如下几个模块,本小节将实战如何构建 RESTful API,并自定义返回数据和HTTP 返回码、以及给 API 接口传入数据,下一小节将实战 Spring Boot 整合 Log4j2 与 Slf4j 实现日志打印和输出到文件: 我是小先,一个专注大数据、分布式技术的非斜杠青年,爱Coding,爱阅读、爱摄影,更爱生活! 源代码仓库: https://github.com/zhshuixian/learn-spring-boot-2 上一章中主要介绍了 Spring Boot 和如何在 IDEA 中创建 Spring Boot 项目,本章将在上一章的基础上,介绍如何运行 Spring Boot 项目,并编写一些 RESTful API,本章主要包含如下内容: 运行 Spring Boot 项目 编写 RESTful API 接口 编写、运行单元测试 设置端口号和 HTTPS 打包成 Jar 1、运行 Spring Boot 程序 IDEA 在完成 Spring Boot 项目的依赖资源下载后,会自动配置 Spring Boot 的启动方式。可以通过快捷键 "Shift + F10" ,或者直接点击右上角的运行按钮。如果是社区版的 Idea,可以通过直接运行

test

送分小仙女□ 提交于 2020-03-10 19:40:49
test 来源: https://www.cnblogs.com/libertycola/p/12457938.html

21. re模块

时光毁灭记忆、已成空白 提交于 2020-03-10 19:30:47
一、正则 1. 字符 元字符 匹配内容 . 匹配出换行外任意字符 \w 匹配字母或数字或下划线 \s 匹配任意空白符 \d 匹配数字 \n 匹配一个换行符 \t 匹配一个制表符 \b 匹配一个单词的结尾 ^ 匹配指定字符的开始 $ 匹配字符串的结尾 \W 匹配非字母数字下划线 \D 匹配非数字 \S 匹配非空白符 a | b 匹配字符a或字符b () 匹配括号内的表达式,也是一个组 [...] 匹配字符组中的字符 [^...] 匹配除了字符组中的字符其他所有字符 2. 量词 量词 匹配内容 * 重复0或更多次 + 重复1或更多次 ? 重复0或1次 {n} 重复n次 {n, } 重复n或更多次 {n, m} 重复n到m次 3. 运用 import re string_test = "hello" (1) . string_1 = re.findall('.', string_test) print(string_1) >['h', 'e', 'l', 'l', 'o'] (2) ^ string_2 = re.findall('^h', string_test) print(string_2) >['h'] (3) $ string_3 = re.findall('o$', string_test) print(string_3) >['o'] (4) * - 当匹配单个字符的时候

codeforces 1312 A B

牧云@^-^@ 提交于 2020-03-10 19:16:23
A. Two Regular Polygons time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given two integers nn and mm (m<nm<n). Consider a convex regular polygon of nn vertices. Recall that a regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length). 转存失败 重新上传 取消 Examples of convex regular polygons Your task is to say if it is possible to build another convex regular polygon with mm vertices such that its center coincides with the center of the initial polygon and each

Logistic Regression with a Neural Network mindset

百般思念 提交于 2020-03-10 18:06:35
Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning. Instructions: Do not use loops (for/while) in your code, unless the instructions explicitly ask you to do so. You will learn to: Build the general architecture of a learning algorithm, including: Initializing parameters Calculating the cost function and its gradient Using an optimization algorithm (gradient descent) Gather all

超强的Lambda Stream流操作

♀尐吖头ヾ 提交于 2020-03-10 13:44:54
超强的Lambda Stream流操作 Stream 流介绍 Stream 不同于其他集合框架,它也不是某种数据结构,也不会保存数据,但是它负责相关计算,使用起来更像一个高级的迭代器。在之前的迭代器中,我们只能先遍历然后在执行业务操作,而现在只需要指定执行什么操作, Stream 就会隐式的遍历然后做出想要的操作。另外 Stream 和迭代器一样的只能单向处理,如同奔腾长江之水一去而不复返。 由于 Stream 流提供了惰性计算和并行处理的能力,在使用并行计算方式时数据会被自动分解成多段然后并行处理,最后将结果汇总。所以 Stream 操作可以让程序运行变得更加高效。 Stream 流概念 Stream 流的使用总是按照一定的步骤进行,可以抽象出下面的使用流程。 数据源(source) -> 数据处理/转换(intermedia) -> 结果处理(terminal ) 2.1. 数据源 数据源(source)也就是数据的来源,可以通过多种方式获得 Stream 数据源,下面列举几种常见的获取方式。 Collection.stream(); 从集合获取流。 Collection.parallelStream(); 从集合获取并行流。 Arrays.stream(T array) or Stream.of(); 从数组获取流。 BufferedReader.lines();

泰坦尼克号生还者预测

无人久伴 提交于 2020-03-10 12:02:26
1912年4月15日,在首次航行期间,泰坦尼克号撞上冰山后沉没,2224名乘客和机组人员中有1502人遇难。这场悲剧轰动了国际社会。沉船导致遇难的原因之一是没有足够的救生艇给乘客和船员。虽然在这场灾难中幸存下来有一些运气在里面,但一些人比其他人更有可能幸存,比如妇女,儿童和上层阶级。 1.数据描述 survival - 是否幸存(0=幸存,1=遇难) pclass - 船票类型(1=一等票,2=二等票,3=三等票) sex - 性别 age - 年龄 sibsp - 泰坦尼克号上该人员兄弟姐妹的数量 parch - 泰坦尼克好上该人员父母或者子女的数量 ticket - 船票编号 fare - 乘客票价 cabin - 客舱号码 embarked - 起航运港(C = Cherbourg, Q = Queenstown, S = Southampton) boat - 救生艇的编号(如果幸存) body - 人体编号(如果遇难并且尸体被找到) home.dest - 出发地到目的地 2.数据分析 2.1 幸存率分析 计算显示只有38%左右的乘客幸存下来,这次惨剧发生的原因是泰坦尼克号上并未携带足够的救生艇,只有20艘,这对于1317名乘客和885名机组人员来说还远远不够。 2.1 阶级地位分析 我们可以看出来头等舱对乘客有62%的生还几率,相比之下三等舱对乘客只有25.5

Django websocket 长连接使用

半世苍凉 提交于 2020-03-10 11:15:24
下载 pip install dwebsocket WebSocket是一种在单个TCP连接上进行全双工通信的协议 WebSocket使得客户端和服务器之间的数据交换变得更加简单,允许服务端主动向客户端推送数据。在WebSocket API中,浏览器和服务器只需要完成一次握手,两者之间就直接可以创建持久性的连接,并进行双向数据传输 现在,很多网站为了实现推送技术,所用的技术都是轮询。轮询是在特定的的时间间隔(如每1秒),由浏览器对服务器发出HTTP请求,然后由服务器返回最新的数据给客户端的浏览器。这种传统的模式带来很明显的缺点,即浏览器需要不断的向服务器发出请求,然而HTTP请求可能包含较长的头部,其中真正有效的数据可能只是很小的一部分,显然这样会浪费很多的带宽等资源。 而比较新的技术去做轮询的效果是Comet。这种技术虽然可以双向通信,但依然需要反复发出请求。而且在Comet中,普遍采用的长链接,也会消耗服务器资源。 在这种情况下,HTML5定义了WebSocket协议,能更好的节省服务器资源和带宽,并且能够更实时地进行通讯 1. http协议是用在应用层的协议,他是基于tcp协议的,http协议建立链接也必须要有三次握手才能发送信息。   http链接分为短链接,长链接,短链接是每次请求都要三次握手才能发送自己的信息。即每一个request对应一个response