1. arr.push() 从后面添加元素,添加一个或多个,返回值为添加完后的数组长度 1 let arr = [1,2,3,4,5] 2 console.log(arr.push(6,7)) // 7 3 console.log(arr) // [1,2,3,4,5,6,7] 2. arr.pop ...
分类:
编程语言 时间:
2020-02-25 12:29:49
阅读次数:
268
__len__():当使用len(A)该对象时调用该方法,当没有该方法是会报错,且返回数据不为整数也会报错 class A(object): def __init__(self,num): self.num = num self.start_num = -1 def __len__(self): ' ...
分类:
编程语言 时间:
2020-02-25 09:55:38
阅读次数:
77
1 #求一百以内奇数之和 2 #用while语句好像不好求和? 3 n=1 4 s=0 5 while n < 101: 6 temp=n%2 7 if temp == 0: 8 pass 9 else: 10 s = s + n 11 n = n + 1 12 print(s) 13 14 15 ...
分类:
其他好文 时间:
2020-02-25 09:26:14
阅读次数:
49
(一)线段树 1.E - Lost Cows N (2 <= N <= 8,000) cows have unique brands in the range 1..N. In a spectacular display of poor judgment, they visited the neig ...
分类:
其他好文 时间:
2020-02-25 00:34:58
阅读次数:
174
1 """ 2 Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. 3 Example 1: 4 Inp ...
分类:
其他好文 时间:
2020-02-25 00:00:16
阅读次数:
59
使用C++容器类访问成员时由于使用问题可能会遇到"terminate called after throwing an instance of 'std::out_of_range'"或者"Abort message: 'terminating with uncaught exception of ...
分类:
其他好文 时间:
2020-02-24 20:28:20
阅读次数:
85
```cpp #include #include #include //#include //c++ 98 static void vectorPart() { //vector 是c++98中引入的动态数组(dynamic array) //namespace std { //template> ... ...
分类:
编程语言 时间:
2020-02-24 20:14:20
阅读次数:
95
np.arange()函数返回一个有终点和起点的固定步长的排列,如[1,2,3,4,5],起点是1,终点是5,步长为1。参数个数情况: np.arange()函数分为一个参数,两个参数,三个参数三种情况1)一个参数时,参数值为终点,起点取默认值0,步长取默认值1。2)两个参数时,第一个参数为起点,第 ...
分类:
编程语言 时间:
2020-02-24 17:04:08
阅读次数:
124
题意 给定一个数$n$,$n≤10^{500,000}$,问$n$最少可以拆分成几个不降数的和。一个不降数是在十进制位下,从高位往低位看,每个数都不会比高位的数更小的数 做法 不降数可以拆成若干个形似$1111...111$的数相加 位数为$l$的全$1$数可以写成$\dfrac{10^{l+1} ...
分类:
其他好文 时间:
2020-02-24 13:09:14
阅读次数:
55