- 博客(21)
- 收藏
- 关注
原创 力扣 77. 组合
题目链接考点:dfs提议:1-n中取k个数,输出所有组合数的可能class Solution {public: vector<vector<int>> combine(int n, int k) { dfs(temp,n,k,0); return ans; }private: vector<vector<int>> ans; vector<int> temp; v.
2020-09-08 11:41:13
358
原创 力扣 347. 前 K 个高频元素
题目链接using 作用等同于 typedef考点:优先队列、小根堆topk (前k大)用小根堆,维护堆大小不超过 k 即可。每次压入堆前和堆顶元素比较,如果比堆顶元素还小,直接扔掉,否则压入堆。检查堆大小是否超过 k,如果超过,弹出堆顶。复杂度是 nlogk避免使用大根堆,因为你得把所有元素压入堆,复杂度是 nlogn,而且还浪费内存。如果是海量元素,那就挂了。[注意]求前 k 大,用小根堆,求前 k 小,用大根堆。class Solution {public: vector
2020-09-07 16:17:31
175
原创 Pat 1139 First Contact (30分)
有错误,待修改//// Created by HP on 2020/9/7.//#include <iostream>#include <map>#include <string>#include <algorithm>#include <vector>using namespace std;int n,k,m;struct node{ string a,b;};int cmp(node x,node y){
2020-09-07 15:34:54
221
原创 PAT-1146 Topological Order (25分)
以下是我的错误代码,在写的时候遇到两个问题,一个是表示拓扑关系的g数组是循环使用的,二是装前驱节点的集合set也是循环使用的。可是第一轮就把他清空了,所有之后的询问不用判断就是正确的,卡了我半天。//// Created by HP on 2020/9/6.//#include <iostream>#include <vector>#include <set>using namespace std;set<int> s[1010];int
2020-09-06 23:17:17
125
原创 PAT-1126 Eulerian Path (25分)
开始的时候忘了要求是连通图的前提,14/25.第一次加判断连通性,因为形参没有传出来,一种错误以下代码是24/25 有一个点没有通过//// Created by ZhangXiaoYu@Ceres_lab on 2020/9/1.//#include <iostream>using namespace std;#include <vector>#include <map>//不要忘了前提要是一个连通图int ans[520];int m,n;
2020-09-01 17:24:31
139
原创 PAT-1142-Maximal Clique
1142一遍ac//// Created by ZhangXiaoYu_TJUT on 2020/7/15.////如果只有一个节点的话,直接输出yes。是不是max任取一个节点的所有邻接节点,如果这个邻接节点也是别人的邻接节点,说明不是max//关于是不是clique:用邻接表表示就可以了,如果e[i][j]==1说明联通,这样遍历所有给出的节点,就可以了。#include <iostream>#include <vector>#include <unor
2020-09-01 11:06:56
175
原创 PAT-1151-LCA in a Binary Tree
1151参考浒鱼鱼//// Created by ZhangXiaoYu@Ceres_lab on 2020/8/31.//#include<iostream>#include <vector>#include <map>#include <cstdio>#include <algorithm>using namespace std;map<int,int> pos;vector<int> in
2020-08-31 17:48:05
111
原创 力扣_0803_每日一题_415_字符串相加
力扣_0803_每日一题_415难度:简单题目描述: 两个简单字符串求和。 直接从前往后遍历,有两处:短的字符串结束了,把进位给到长字符串剩下的部分;长字符串结束了把进位加到结果上。以上过程进位的计算一样,循环加判断能一次搞定class Solution {public: string addStrings(string num1, string num2) { string str; int cur=0,i = num1.size()-1,j=num
2020-08-03 19:55:54
128
原创 力扣_105. 从前序与中序遍历序列构造二叉树
题目描述:从中序遍历和先序遍历重建二叉树思路:迭代代码:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public:
2020-05-30 11:47:32
122
原创 YOLOv3-Pytorch版本训练教程
YOLOv3-Pytorch版本训练教程开始前的说明环境配置1.下载源码2.下载训练过程中会用到的预权重3.制作自己的数据集1.图片标定2.建立如下文件夹3.提取训练集文件名4.生成labels及完整文件路径4.修改参数1.修改cfg文件2.新建data和names文件5.开始训练6.笔者遇到的问题1. 'No labels found. Incorrect label paths provid...
2019-07-21 19:33:16
5617
27
原创 UART,COM,I2C,SPI区别
参见博客:http://blog.youkuaiyun.com/junyeer/article/details/46761853祈求博主不要删
2018-03-21 21:41:51
242
原创 HDU 1800 Flying to MARS
map和哈希都可以map的话很悬,scanf换成cin就tle,换回来就ac哈希的还在看ELFHash
2018-03-20 18:54:23
169
原创 hdu 2795 Billboard
if (h > n) h = n;缺了这句就runtime error今天八百个越界了,特么的气死现在还不懂为什么?
2018-03-19 20:47:05
161
原创 hdu 1698 Just a hook
int m=(l+r)>>1 写成int m=(l+r)>.1导致runtime error debug 了俩小时
2018-03-19 19:32:23
120
原创 hdu 1745 I hate it
一直TLE把scanf("%c",ch)换成scanf("%s",op);op[2]就好了,奇怪。找了两小时bug
2018-03-19 15:22:22
163
原创 POJ 1321 棋盘问题
#include#include#includeusing namespace std;char board[8][8];int judge[8];int sum;int n,k;int main(int argc, char const *argv[]){ int dfs(int line,int step); while(cin>>n>>k){ sum=0;
2017-07-24 20:47:57
185
原创 数论的同余定理
算法分析: 同余定理1. ( m + n ) % c = (m % c + n% c) % c2. (m* n ) % c =( (m % c ) * ( n% c)) % c3. (m ^ n) % c = ((m % c) ^ n) % c
2017-06-30 23:51:20
506
原创 配置opencv+vs2010遇到的最大的一个坑
无法编译。为了填这个坑,软件重装试过了,系统重装也试过了(换了一个贼几把难用的系统)。网上的教程翻了个底朝天也没有 找到类似的解决方案。mmp。最后细细品味opencv 书的时候 。发现了 贼 隐秘的 几句话 。关于 路径添加 时 x64和 x86的区别。mmp。竟然是编译器选择 的问题?弄好之后,我的理解是:如果你给他两个编译的方式,他
2017-06-29 19:43:36
341
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人