函数 定义函数 def printinfo(): print(" ") print(" 人生苦短 我用python ") print(" ") ## 函数调用 printinfo() 带参数的函数的定义 def sum2num(a,b): sum=a+b print(sum) sum2num(11, ...
分类:
其他好文 时间:
2020-06-27 20:12:47
阅读次数:
89
给定一棵大小为 \(n\) 的树,每个结点都有颜色。 定义 \(s(i, j)\) 为从 \(i\) 到 \(j\) 的不同颜色数量以及 \(sum_i = \sum\limits_{j= 1}^ns(i,j)\)。 求出所有的 \(sum_i\)。 较为复杂的点分治题。 也可以用差分 \(O(n) ...
分类:
其他好文 时间:
2020-06-27 13:15:18
阅读次数:
52
MySQL关系型数据库RDS中的老大哥,增删改查是MySQL入门的基础 增删改查语句增删改查的语句命令为 增:insert删:delete改:update查:SELECT或者show 库操作 创建数据库:create database shujukuba;创建带字符集的数据库:create data ...
分类:
数据库 时间:
2020-06-27 10:11:02
阅读次数:
277
Reverse String (E) 题目 Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space ...
分类:
其他好文 时间:
2020-06-27 10:04:20
阅读次数:
50
Combination Sum II (M) 题目 Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidate ...
分类:
其他好文 时间:
2020-06-27 10:04:01
阅读次数:
52
珠心算:目前和为9以内加减法;最多随机7个数字,从第二个数字开始,随机数加前面的数字和不超过9, 差不能小于0; 据此规则得: 0-sum<=a <= 9-sum; 得知待填入数字a的范围。 通过for 遍历, 获得处在这个区间的数字在数组中的index, 以这个index做为 random.nex ...
分类:
其他好文 时间:
2020-06-27 09:49:41
阅读次数:
57
Range Sum Query - Immutable (E) 题目 Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Give ...
分类:
其他好文 时间:
2020-06-27 09:44:58
阅读次数:
46
恢复内容开始 Range Sum Query 2D - Immutable (M) 题目 Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left cor ...
分类:
其他好文 时间:
2020-06-27 09:36:59
阅读次数:
61
Description 题目大意: $f(x)$为十进制下x每一位上的数字的和。求满足$f(x)+f(x+1)+...+f(x+k)=n$的最小x。 思路 由于k特别小(<=9),故x+k至多发生一次进位。x每加1,必有某一位加上1。如果发生进位,那么$f(x)$只要额外减去若干个9(进位发生后9变 ...
分类:
其他好文 时间:
2020-06-26 23:57:16
阅读次数:
130
给定一个非负整数序列 $\{a\}$,初始长度为 $n$。
有 $m$ 个操作,有以下两种操作类型:
1. `A x`:添加操作,表示在序列末尾添加一个数 $x$,序列的长度 $n+1$。
2. `Q l r x`:询问操作,你需要找到一个位置 $p$,满足 $l \le p \le... ...
分类:
其他好文 时间:
2020-06-26 21:53:20
阅读次数:
48