问题: 给出给定数组的描述: Example 1: Input: [0,1,2,4,5,7] Output: ["0->2","4->5","7"] Explanation: 0,1,2 form a continuous range; 4,5 form a continuous range. Ex ...
分类:
其他好文 时间:
2020-03-15 15:03:03
阅读次数:
53
问题:求一个数列里三个数相乘的最大值 Input: [1,2,3] Output: 6 Input: [1,2,3,4] Output: 24 Note: 1.The length of the given array will be in range [3,104] and all element ...
分类:
其他好文 时间:
2020-03-15 13:25:00
阅读次数:
53
(一)Python编写,输入一个字符串,输出字符串中每个字符和它的下标组成的新字符串 方法一: s=input('input a string:') s1=''.join(['%s%d' % (s[i],i) for i in range(len(s))]) print(s1) 方法二: def p ...
分类:
编程语言 时间:
2020-03-15 13:23:00
阅读次数:
54
import turtle turtle.pensize(5) turtle.pencolor("yellow") turtle.fillcolor("red") turtle.begin_fill() for i in range(0,5): turtle.forward(100) turtle. ...
分类:
其他好文 时间:
2020-03-15 13:07:42
阅读次数:
80
import turtle as t t.color("black","red") t.begin_fill() for i in range(5): t.fd(100) t.rt(144) t.end_fill() t.done ...
分类:
其他好文 时间:
2020-03-15 11:53:18
阅读次数:
62
描述 归并排序和快速排序都是使用分而治之的思维.归并排序侧重点是最终结果的合并.快速排序的重点则是放在了子问题的分解上面. 代码一 def quick_sort(arr): len_arr = len(arr) if len_arr 参考 "分而治之" "算法设计与分析理论" "Python排序算法 ...
分类:
编程语言 时间:
2020-03-15 11:32:23
阅读次数:
63
import turtle turtle.pensize(1) turtle.pencolor("black") #画笔黑色 turtle.fillcolor("red") #内部填充红色 #绘制五角星# turtle.begin_fill() for _ in range(5): #重复执行5次 ...
分类:
其他好文 时间:
2020-03-15 11:19:38
阅读次数:
47
starting with a factorial : def function_factorial(n): number=1 for i in range(1,n+1): number *=i return number print(function_factorial( n) use this ...
分类:
编程语言 时间:
2020-03-15 09:29:22
阅读次数:
85
常用端口及协议 (1)常用端口 (2)基于TCP/UDP的协议 (3)OSI模型各层使用协议 http请求报文: 一个HTTP请求报文由请求行(请求方法、URI、HTTP协议版本)、请求头部(request header)、空行和请求数据4个部分构成。 http响应报文: HTTP响应报文由状态行( ...
分类:
其他好文 时间:
2020-03-15 00:12:34
阅读次数:
70
N=eval(input(" 请输入一个数:")) for i in range (5): print(pow(N,i)) ...
分类:
其他好文 时间:
2020-03-14 23:59:58
阅读次数:
82