上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页
摘要: A题 模拟过程考查对临界条件的判断 #include<bits/stdc++.h> using namespace std; int main() { int T; cin >> T; while (T--) { int A, B, C, D; cin >> A >> B >> C >> D; in 阅读全文
posted @ 2020-04-01 09:30 LightAc 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 在求解欧拉回路的问题中我们可以采用fleury算法。 然而在进行算法竞赛时,如果只是求欧拉回路我们可以采用DFS进行实现,需要注意的小细节时在输出边时需要在回溯阶段逆向输出因为遇到 1->2->3->2->1这种图会出现走死路情况 来看道例题: UVA10054 #include <bits/std 阅读全文
posted @ 2020-03-30 16:30 LightAc 阅读(864) 评论(0) 推荐(0) 编辑
摘要: 以蓝书为学习参考,进行的栈的学习 例题1: 实现一个栈,支持Push,Pop和GetMin(查询栈中最小的值)在O(1)完成 算法实现思路:建立两个栈,A存原本的数据,B存以栈底开头的每段数据的最小值 Push(X),在A中插入X,在B中插入min(B的栈顶数据,X)。执行GetMin只需要输出B. 阅读全文
posted @ 2020-03-25 22:37 LightAc 阅读(145) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector<string> wordBreak(string s, vector<string>& wordDict) { if (m.count(s)) return m[s]; //判断map中有没有s if (s.empty()) retur 阅读全文
posted @ 2020-03-19 16:55 LightAc 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 1. Sample Input 6 -2 11 -4 13 -5 -2 10 -10 1 2 3 4 -5 -23 3 7 -21 6 5 -8 3 2 5 0 1 10 3 -1 -5 -2 3 -1 0 -2 0 Sample Output 20 11 13 10 1 4 10 3 5 10 1 阅读全文
posted @ 2020-03-18 22:49 LightAc 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 最终刷题太多了博客思路慢慢更新 1.利用havel定理判断可不可以简单图化的一道好题 Sample Input 3 7 4 3 1 5 4 2 1 6 4 3 1 4 2 0 6 2 3 1 1 2 1 Sample Output YES 0 1 0 1 1 0 1 1 0 0 1 1 0 0 0 阅读全文
posted @ 2020-03-18 22:33 LightAc 阅读(161) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <cmath> using namespace std; double calcualateCircle(double r = 0) { return acos(-1) * r * r; } double calcualateRectangl 阅读全文
posted @ 2020-03-13 09:06 LightAc 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 1. Sample Input 9 5 2 1 5 2 1 5 2 1 4 1 2 3 4 0 Sample Output 6 5 #include <bits/stdc++.h> using namespace std; typedef long long ll; int a[100]; bool 阅读全文
posted @ 2020-03-12 23:06 LightAc 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 1. Sample Input 6 9 ....#. .....# ...... ...... ...... ...... ...... #@...# .#..#. 11 9 .#......... .#.#######. .#.#.....#. .#.#.###.#. .#.#..@#.#. .# 阅读全文
posted @ 2020-03-12 08:19 LightAc 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 匈牙利算法 匈牙利算法是一种在多项式时间内求解任务分配问题的组合优化算法 该算法是求解二分图的完全匹配问题 建图:把行号放左边点集,列号放在右边点集。 关键是求该二分图的最小边覆盖点集使得每条边都被至少一个点覆盖。 算法模板: //使用bfs实现 int dfs(int e) { for(int i 阅读全文
posted @ 2020-03-07 22:15 LightAc 阅读(230) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页
返回顶端