描述 给一整数 n, 返回杨辉三角的前 n 行 0 ? n ? 20 杨辉三角也被叫做帕斯卡三角形. --(Wikipedia) 样例 样例 1: 输入 : n = 4 输出 : [ [1] [1,1] [1,2,1] [1,3,3,1] ] class Solution: """ @param n ...
分类:
其他好文 时间:
2021-04-09 13:21:46
阅读次数:
0
思路:从s1的第0位开始切片len(s2)个字符串进行比较,相同则计数加1,依次后移,直到最后. def search_substr(s1, s2): if len(s2) > len(s1): return 0 cnt = 0 for i in range(len(s1)): print(i) t ...
分类:
编程语言 时间:
2021-04-09 13:07:30
阅读次数:
0
需要配置一下,才可直接用局域网 IP 访问,方法如下: 给 dev 添加--host 0.0.0.0 属性: "scripts": { "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js ...
分类:
其他好文 时间:
2021-04-09 13:06:40
阅读次数:
0
模版层 模版语法传值 {{}}:变量相关 {%%}:逻辑相关 def index(request): # 模版语法可以传递的后端python数据类型 n = 123 f = 11.11 s = '字符串' b = True l = [111,222,333,444] t = (111,222,333 ...
分类:
其他好文 时间:
2021-04-08 13:59:36
阅读次数:
0
#函数 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
例子 from rest_framework.views import APIView class StudentAPIView(APIView): def get(self, request): pk = request.query_params.get(pk) student_obj = Stu ...
分类:
Web程序 时间:
2021-04-08 13:26:42
阅读次数:
0
题目链接:https://www.acwing.com/problem/content/275/ 思路:首先要知道一个性质 : 一定存在一组最优解b[i] 使得每个b[i]都在a[i] 中出现过 证明略 然后考虑dp[i][j] 代表前i个a[i] 一定匹配好 且b中最后一个数是b[j] 的最小值 ...
分类:
其他好文 时间:
2021-04-08 12:57:12
阅读次数:
0
1.什么是函数的嵌套""" 互相嵌套的两个函数: 包裹在外层的叫做外函数,内层的就是内函数 1 def outer(): 2 # inner() 3 def inner(): 4 print("我是inner函数") (1)内部函数可以直接在函数外部调用么 不行 inner() (2)调用外部函数后 ...
分类:
其他好文 时间:
2021-04-08 12:53:04
阅读次数:
0
需要在.h文件中增加save()函数 //保存文件 void save(); 注意上面要写头文件 #include<fstream> #define FILENAME "empfile.txt" 在.cpp文件中编写该函数 void workManager::save() { ofstream of ...
分类:
其他好文 时间:
2021-04-07 11:45:58
阅读次数:
0
#include<bits/stdc++.h>using namespace std;int maze [5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,};typedef struct { ...
分类:
其他好文 时间:
2021-04-07 11:33:01
阅读次数:
0