码迷,mamicode.com
首页 >  
搜索关键字:while break continue    ( 40024个结果
n数之和总结
1.两数之和 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 的那 两个 整数,并返回它们的数组下标。 可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 可以按任意顺序返回答案。 做法:hash表,O(n) class Sol ...
分类:其他好文   时间:2021-04-19 14:57:12    阅读次数:0
POJ1631 - Bridging signals - LIS优化 - 二分+dp - nlogn
##题意 求最长上升子序列长度 ##思路 本题直接用dp写,会超时,需要优化 优化办法:二分+dp ##AC代码 //4test n //6 p //4 2 6 3 1 5 ->3 //10 //2 3 4 5 6 7 8 9 10 1 ->9 //8 //8 7 6 5 4 3 2 1 ->1 / ...
分类:其他好文   时间:2021-04-19 14:47:09    阅读次数:0
HDU1160 - FatMouse's Speed - 最长上升子序列的变形+记录路径
##思路 最长上升子序列的变形+记录路径 ##AC代码 #include<iostream> #include<cmath> #include<string.h> #include<algorithm> #include<stdio.h> #include<iomanip> #define inf ...
分类:其他好文   时间:2021-04-19 14:43:51    阅读次数:0
变量,元字符,流程判断if,while、for循环
一: shell编程介绍 1、一个shell脚本运行必须要拥有r和x权限; chamod u+x 1.txt 2、运行一个shell脚本的3个步骤: (1)启动bash解释器 (2)bash把文件内容从硬盘读入内存 (3)bash把读入到内存的内容进行语法解释,控制操作系统执行shell代码 写脚本 ...
分类:其他好文   时间:2021-04-16 12:25:54    阅读次数:0
python判断字典值或键在不在字典里
dict1={'name':'Lara','age':18} #判断键在不在字典中 for one in dict1: if 'name' in dict1:#或dict1.keys() print('key在字典中!') break #判断值在不在字典中 for one in dict1: if ...
分类:编程语言   时间:2021-04-16 12:04:54    阅读次数:0
模拟cpu/mem/io使用率
模拟cpu使用率 脚本: 可以将1个cpu-core打满 k.c #include <stdlib.h> int main() { while(1); return 0; } gcc -o out k.c ./out 查看top可以看到将1个cpu-core打满,可以根据需要,并发启动多个进程将多个 ...
分类:其他好文   时间:2021-04-16 12:03:28    阅读次数:0
nginx响应超时upstream timed out (110: Connection timed out) while reading response header from upstream
问题描述后台server服务响应时间正常,但是请求没有打到服务器,在nginx很慢才看到error日志,如下: 2018/07/26 10:17:42 [error] 45762#0: *7489 upstream timed out (110: Connection timed out) whil ...
分类:其他好文   时间:2021-04-15 12:25:45    阅读次数:0
Cannot deserialize instance of `java.util.ArrayList<org.jeecg.modules.face.entity.FaceDevice>` out of START_OBJECT token
远程调用出现json解析异常 操作失败,Error while extracting response for type [java.util.List<org.jeecg.modules.face.entity.FaceDevice>] and content type [application/ ...
分类:编程语言   时间:2021-04-14 12:42:30    阅读次数:0
使用Python + OpenCV文本分割
从网上看到了对一张超市购物小票做文字分割,于是想用Python+OpenCV实现从小票上面分割出字符,原图如下: 最后分割的效果如下图所示: 本文使用水平投影和垂直投影的方式进行图像分割,根据投影的区域大小尺寸分割每行和每块的区域,首先我们对原始图像进行二值化处理 然后分别进行水平投影和垂直投影: ...
分类:编程语言   时间:2021-04-14 12:36:31    阅读次数:0
单向链表为什么要用一个辅助变量遍历
对于链表添加操作,假如不考虑按序号添加,则可以写一个简单的方法: public void add(HeroNode heroNode) { //因为head节点不能动,因此我们需要一个辅助变量遍历 HeroNode temp = head; //遍历链表,找到最后 while (true) { // ...
分类:其他好文   时间:2021-04-14 12:35:54    阅读次数:0
40024条   上一页 1 ... 27 28 29 30 31 ... 4003 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!