上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 22 下一页
摘要: 白给题1 #include <bits/stdc++.h> using namespace std; typedef long long ll; int main () { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while 阅读全文
posted @ 2020-04-27 17:17 LightAc 阅读(192) 评论(1) 推荐(0) 编辑
摘要: 白给题1 #include <bits/stdc++.h> using namespace std; int main () { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while(t--) { int n; cin >> 阅读全文
posted @ 2020-04-22 10:02 LightAc 阅读(273) 评论(0) 推荐(0) 编辑
摘要: 直接用DFS进行搜索即可 class Solution { public: int numIslands(vector<vector<char>>& grid) { if(grid.empty()) { return 0; } int ans = 0; for(int i = 0; i < grid 阅读全文
posted @ 2020-04-20 15:54 LightAc 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Matrix-Tree 定理又称基尔霍夫矩阵树定理,其用于解决:给定 n 个点 m 条边的无向图,求图的生成树个数的问题。 【基尔霍夫矩阵】1.基本定义1)无向图 G:给定 n 个点,m 条边的无向图,设点集为 V,边集为 E,则其记为 G(V,E)2)度数矩阵 D[G]:当 i≠j 时,D[i][ 阅读全文
posted @ 2020-04-20 15:20 LightAc 阅读(389) 评论(0) 推荐(0) 编辑
摘要: 思路:模拟 class Solution { public: bool isValidSudoku(vector<vector<char>>& board) { int a[10]; for(int i = 0; i < board.size(); ++i) { memset(a, 0, sizeo 阅读全文
posted @ 2020-04-16 21:54 LightAc 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 思路:也没啥好说的了,就是模拟然后注意输入可能为空的判断。运用运算符重载先sort一波。应该有更简单的解法,待我研究出来再更新。 class Solution { public: static bool cmp(pair<int, int> P1, pair<int, int> P2) { if(P 阅读全文
posted @ 2020-04-16 21:27 LightAc 阅读(122) 评论(0) 推荐(0) 编辑
摘要: https://www.bilibili.com/video/BV1FK411j7JS 阅读全文
posted @ 2020-04-16 10:19 LightAc 阅读(138) 评论(0) 推荐(0) 编辑
摘要: //答案 //计组实验1答案 //1-1 //第1关 module fa_behavioral(a,b,ci,s,co);//考虑进位的加法器模块 input a,b; input ci; output s; output co; // 请在下面添加代码,完成一位全加器功能 /* Begin */ 阅读全文
posted @ 2020-04-16 10:13 LightAc 阅读(2210) 评论(0) 推荐(1) 编辑
摘要: KMP是一种字符串的模式匹配算法 如图我们需要实现T串匹配S串。绿色代表匹配成功,黄色代表开始出现匹配错误。 在下一次匹配错误中我们把i设置为i-j+2 然后继续匹配,这是朴素的匹配方法 我们这时候需要思考一个问题,能不能让匹配过程变得更快?让T多往后移动一点儿。 我们需要引入最长公共前后缀概念。 阅读全文
posted @ 2020-04-09 11:01 LightAc 阅读(164) 评论(0) 推荐(1) 编辑
摘要: //这里采用dfs算法 class Solution { public: vector<string> generateParenthesis(int n) { vector<string> res; func(res, "", 0, 0, n); return res; } void func(v 阅读全文
posted @ 2020-04-09 10:37 LightAc 阅读(115) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 22 下一页
返回顶端