#函数 def hello(): #定义函数 print("python 你好!") hello() #调用函数 def add(a,b): #定义函数 return a+b #返回值 add(1,2) add #直接用函数名,可返回函数变量名的内存地址 x = add #将函数名赋值给变量 x(1 ...
分类:
编程语言 时间:
2021-04-08 13:50:11
阅读次数:
0
题目 F : Four-tuples 输入 1 1 1 2 2 3 3 4 4 输出 1 题意 给l1, r1, l2, r2, l3, r3, l4, r4? , 八个数据, 要求输出在区间[l1, r1] , [l2, r2] , [l3, r3] , [l4, r4?] (记为A, B, C, ...
分类:
其他好文 时间:
2021-04-08 13:43:44
阅读次数:
0
题目: Given any string of N (≥) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as: h d e l ...
分类:
其他好文 时间:
2021-04-08 13:31:19
阅读次数:
0
题目:People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, w ...
分类:
其他好文 时间:
2021-04-08 13:28:06
阅读次数:
0
仅供自己学习 思路: 思路比较简单,但要注意细节处理。 一开始就是想遍历寻找nums[i]<nums[i-1]获得旋转点,然后对这两侧的数组分别使用二分搜索,但是一直报错,找不到原因。 根据题解二分可知二分的本质是二段性,而非单调性。只要一段满足某个性质,另外一段不满足这个性质就可以用二分。 对于一 ...
分类:
其他好文 时间:
2021-04-08 13:18:01
阅读次数:
0
注意是 d < x.d struct Node { int d, e; bool operator < (const Node x) const { return d < x.d; //从小到大排序 } }; ...
分类:
其他好文 时间:
2021-04-08 13:16:49
阅读次数:
0
arguments和rest arguments JavaScript还有一个免费赠送的关键字 arguments ,它只在函数内部起作用,并且永远指向当前函数的调用者传入的所有参数。 arguments 类似 Array 但它不是一个 Array : function foo(x) { alert ...
分类:
其他好文 时间:
2021-04-08 13:14:15
阅读次数:
0
方式一(将整数转换为字符串,在转换为字符数组): public boolean isPalindrome(int x) { if (x < 0) { return false; } char[] chars = new String(Integer.toString(x)).toCharArray( ...
分类:
其他好文 时间:
2021-04-08 13:10:24
阅读次数:
0
最近参加了huawei的一个比赛,初赛刚结束,结果未知。虽然过程艰辛,经常搞到夜里1点,但是学到的知识还是挺多的。在学校没有参加很多的比赛也是一种遗憾,不得不说在学校自己的时间是真的多啊。感慨一番,继续造题。加油! 题目: 一个整型数组 nums 里除两个数字之外,其他数字都出现了两次。请写程序找出 ...
分类:
编程语言 时间:
2021-04-08 13:02:38
阅读次数:
0
public static Object copyOf(Object a,int newLength){ Class cl = a.getClass(); if(!cl.isArray()){ return null; } Class componentType = cl.getComponentT ...
分类:
编程语言 时间:
2021-04-08 12:57:40
阅读次数:
0