#include <iostream> #include <string> #define MAX 500 using namespace std; struct person { string name; int age; }; struct contact { person persons[MA ...
分类:
编程语言 时间:
2020-10-05 22:33:17
阅读次数:
48
题意 树的层序遍历的问题,找到结点数最多的一层,输出结点树和对应层号 思路 看到是树层序遍历就立马反应过来用BFS做,可以说是裸模版的题目了 层序遍历在每次扩展状态的时候都是取一层的结点数进行扩展,此时就可以直接比较来找题目要求的解了 代码 #include <algorithm> #include ...
分类:
其他好文 时间:
2020-10-05 21:55:34
阅读次数:
27
模仿论坛结构,数据库如下: 其中id是自增编号,后面几列依次是:标题、内容、作者。 按照设计,控制器应当包含5个action。 public ActionResult Index() { //初始化、查询数据库并显示数据,返回首页 return View(); } public ActionResu ...
分类:
Web程序 时间:
2020-10-05 21:54:24
阅读次数:
35
JSON JavaScript 是存储和交换文本信息的语法。 是Web的编程语言 对象实例 JSON对象是一种【JavaScript对象】表示法。 key 必须是字符串。 var person={ "firstName":"John", "lastName":"Doe", "age":50, "ey ...
分类:
编程语言 时间:
2020-10-05 21:50:00
阅读次数:
35
int numJewelsInStones(char * J, char * S){ int i,num=0; for(i=0;S[i]!='\0';i++){ if(strchr(J,S[i])) //若S[i]在J中则返回一个S[i]所在位置的指针 num++; } return num; } ...
分类:
其他好文 时间:
2020-09-24 22:06:02
阅读次数:
32
现在有两个对象: let a = {name: 'zj', tel: '123', sex: 0, id: 1}let b = {name: 'zj', tel: '123', sex: 0, id: 1}如何判断对象a和对象b相等呢?a==b //false Object.is(a,b) //fa ...
分类:
其他好文 时间:
2020-09-24 22:04:06
阅读次数:
63
import xlrdapply_dic = []def get_excel(excel_path): with xlrd.open_workbook(excel_path) as workbook : name_sheets = workbook.sheet_names() #获取Excel的sh ...
分类:
其他好文 时间:
2020-09-24 21:49:24
阅读次数:
42
在做题时遇到 include <stdio.h> int main()6 { int i = 0, n = 0; double sum = 0; scanf_s("%d", &n); for (i = 1;i <= n;i++) { sum = sum + 1.0 / 2 * n - 1; prin ...
分类:
其他好文 时间:
2020-09-24 21:42:13
阅读次数:
33
代码如下 #include<iostream> using namespace std; const int MAXN = 1000 + 5; struct Node // 进去一个出去一个,很明显,队列 { int num; // 保存进去的数字 }; struct Node queue[MAXN ...
分类:
其他好文 时间:
2020-09-24 21:25:32
阅读次数:
42
解法: 1. 方法:循环和位移动 注意:不可以将n右移,必须设定掩码,n可能为负数。 var hammingWeight = function (n) { let ans = 0; let mask = 1; for (let i = 0; i < 32; i++) { ans += (n & ma ...
分类:
其他好文 时间:
2020-09-24 21:24:45
阅读次数:
33