1104 Sum of Number Segments (20分) Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the s ...
分类:
其他好文 时间:
2020-06-30 00:44:09
阅读次数:
60
list1=[9,5,3,2,8,1] num = 0 while num < len(list1): 总共要循环的次数 for i in range(len(list1)-1): 第一轮比较挑选出一个最大值 if list1[i]<list1[i+1]: list1[i],list[i+1]=li ...
分类:
编程语言 时间:
2020-06-29 22:51:46
阅读次数:
65
题目链接:two-num 思路一:两层for循环暴力求解,结果超时 1 def twoSum(nums,target):#使用二维数组 2 for i in range(len(nums)): 3 for j in np.arange(i+1,len(nums)): 4 if(nums[i] + n ...
分类:
其他好文 时间:
2020-06-29 17:11:10
阅读次数:
41
agc045_c Range Set https://atcoder.jp/contests/agc045/tasks/agc045_c Tutorial https://img.atcoder.jp/agc045/editorial.pdf 考虑如何判断是否能得到某个01串 对于长度大于等于$A$ ...
分类:
其他好文 时间:
2020-06-29 13:53:23
阅读次数:
44
在jsp中获取数据库数据 <% Class.forName("com.mysql.jdbc.Driver");//加载mysql驱动 Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/test1", "r ...
分类:
数据库 时间:
2020-06-29 09:37:42
阅读次数:
71
冒泡排序 def maopaoSort(array): #一共需要n次的循环,每一个都要找到没有拍好序的最大值 for i in range(len(array)): #将没有排好序的数组找最大值 for j in range(len(array)-i-1): if array[j]>array[j ...
分类:
编程语言 时间:
2020-06-29 09:19:44
阅读次数:
57
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo ...
分类:
其他好文 时间:
2020-06-29 00:18:05
阅读次数:
56
一行代码实现 1-100之和? print(sum(range(1,101))) 如何在一个函数内部修改全局变量 # 使用global关键字 a = 10 def fn(): global a a = 4 fn() print(a) # 4 列出5个python标准库 # os 模块 # re 模块 ...
分类:
编程语言 时间:
2020-06-28 22:24:01
阅读次数:
154
def count_factors(): n = int(input('input the num:')) num = n res = [] while n > 1: for i in range(2, n+1): if n % i == 0: n = int(n/i) res.append(i) ...
分类:
其他好文 时间:
2020-06-28 20:47:41
阅读次数:
250
1.while循环
2.while嵌套
3.for循环遍历
4.for循环结合range使用
5.break和continue
6.循环语句结合else语句使用 ...
分类:
其他好文 时间:
2020-06-28 18:48:38
阅读次数:
43