自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

知行合一

BUILD YOUR WORLD

  • 博客(107)
  • 资源 (1)
  • 收藏
  • 关注

原创 C++_(矩阵)快速幂

#include <iostream>#include <cstdio>using namespace std;const int MOD = 1000;int POW(long long &num);int times;long long N;int main(){ scanf("%d", &times); while(times--) { sca

2016-05-14 20:35:59 2321

原创 C++_FatMouse' Trade(贪心)

DescriptionFatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room contains J[i] p

2016-05-14 20:25:04 750

原创 C++_DFS求连通度

DescriptionBenny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are placed in these squares. Different square has a differen

2016-05-10 22:04:34 1141

原创 C++_BFS求最短路径

DescriptionAngel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison.Angel’s friends wa

2016-05-09 21:39:37 3046

原创 Github中.gitignore的使用

使用.gitignore可以选择不向远程仓库中上传文件,但是今天在使用的过程中一直没用。看了看说明是如果在git init之前文件已经存在了,那么该文件就会加入到git的文件树中,所以.gitignore才不会生效,执行以下命令git rm --cached 要删除的文件 -r其中-r表示删除的内容中存在文件夹 执行完上述的命令之后再commit一次上传后就会将忽略的文件删除

2016-04-26 18:56:39 958

原创 Leetcode_162_Find Peak Element

A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in that case

2016-04-25 22:31:24 393

原创 C_银行家算法的实现

#include <stdio.h>#include <stdlib.h>#define PRONUM 5#define RESNUM 4#define SAFE 1#define UNSAFE 0int max[PRONUM][RESNUM];int available[RESNUM];int allocation[PRONUM][RESNUM];int need[PRONUM][

2016-04-22 20:59:03 801

原创 Leetcode_226_Invert Binary Tree

Invert a binary tree. 题意:反转一棵二叉树 思路:每次交换即可 坑:暂无 代码:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int

2016-04-22 09:47:19 384

原创 Linux_进程创建

进程创建1、linux创建进程的方式是先通过调用fork创建一个和调用进程基本一样的子进程,二者之间的区别在于PID和PPID不同。然后子进程调用exec函数装载一个新的进程到地址空间执行。 其他的操作系统产生子进程的方式是spawn:在新的地址空间中创建进程,然后载入可执行文件执行。 2、传统的fork是将所有的资源都复制给新的进程,但linux使用了COW(copy-on-write)技术,

2016-04-22 09:39:37 955

原创 Leetcode_104_Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.题意:求一棵二叉树的最大深度 思路:递归 坑:暂无代码:/** * Defini

2016-04-20 18:08:51 397

原创 Leetcode_338_Counting Bits

Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array.Example: For num = 5 you sh

2016-04-20 18:06:26 462

原创 Leetcode_258_Add Digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, r

2016-04-17 11:15:17 458

原创 Leetcode_326_Power of Three

Given an integer, write a function to determine if it is a power of three.Follow up: Could you do it without using any loop / recursion?题意:判断一个数是否为3的幂 思路:解决了2的幂以为这个题也很简单,一直取余除三就行,但是看了看提议要求尽量不用递归和循环,所

2016-04-13 22:45:25 418

原创 Leetcode_144_Binary Tree Preorder Traversal

Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3].Note: Recursive solution is trivial,

2016-04-13 17:39:22 376

原创 Leetcode_94_Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,3,2].Note: Recursive solution is trivial,

2016-04-12 22:37:26 384

原创 Leetcode_171_Excel Sheet Column Number

Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example:A -> 1B -> 2C -> 3...Z -> 26AA -> 27AB -> 28 题意:给

2016-04-12 18:06:11 286

原创 Leetcode_168_Excel Sheet Column Number

Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example:1 -> A2 -> B3 -> C...26 -> Z27 -> AA28 -> AB 题意:给定一个正整数n,给出在EXCEL中列的值 思路:取余,相除,和以前在学校做的根据

2016-04-12 17:55:19 278

原创 Leetcode_86_Partition List

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of the

2016-04-11 17:37:18 216

转载 汇编_32位CPU寄存器和汇编指令

32位CPU所含有的寄存器有: 4个数据寄存器(EAX、EBX、ECX和EDX) 2个变址和指针寄存器(ESI和EDI) 2个指针寄存器(ESP和EBP) 6个段寄存器(ES、CS、SS、DS、FS和GS) 1个指令指针寄存器(EIP) 1个标志寄存器(EFlags) 1、数据寄存器 数据寄存器主要用来保存操作数和运算结果等信息,从而节省读取操作数所需占用总线和访问存储器的时间。 32位CPU有

2016-04-11 17:02:59 587

原创 Leetcode_105_Construct Binary Tree from Preorder and Inorder Traversal

这个题和上一个题差不多是一样的,只不过后序变成了前序,但是思路还是一样的,这次直接顺着上次的思路写的,一遍A了,算是记住这种算法了。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * Tr

2016-04-11 15:10:49 398

原创 Leetcode_106_Construct Binary Tree from Inorder and Postorder Traversal

Given inorder and postorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree.根据中序和后序遍历确定一个二叉树,一开始打算每一个都用vector储存,结果内存超限了。 内存超限代码:/** * Def

2016-04-09 09:59:39 274

原创 Leetcode_78_Subsets

Given a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order. The solution set must not contain duplicate subsets.For example, If nums

2016-04-07 22:18:35 275

原创 Leetcode_300_Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence.For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7, 101], therefore

2016-04-07 19:28:10 307

原创 Leetcode_231_Power of Two

Given an integer, write a function to determine if it is a power of two. 原题链接思路:如果那个数是2的幂,那么二进制表示中一定只有一个1。 例如1:00012:00104:0100… 所以就想按位来检验是否为2的幂class Solution {public: bool isPowerOfTwo(in

2016-04-07 19:12:07 257

转载 C_argc与argv

argc and argvSo far, all the programs we have written can be run with a single command. For example, if we compile an executable called myprog, we can run it from within the same directory with the fol

2016-04-03 10:38:42 398

原创 Python_模拟登陆新浪微博

模拟网页登陆1、下载http抓包软件Fiddler,打开后可以抓取到所有经过80端口的数据包 2、打开登陆新浪微博的界面,可以在Fiddler中看到相关的信息,查了一晚上的资料得知,新浪微博登陆主要靠3个请求 1) 这个请求用于获得几个用于加密的参数 2) 这个请求将加密的用户名和密码发送出去 3) 这个请求就是用于登陆的 3、分析第一个请求 其中最后一个是时间戳 返回值中的

2016-03-26 14:22:22 661

原创 Qt_几个错误

1、在其他类里面想要用MainWindow的槽函数 一开始想在其他类里新建一个MainWindow,结果递归了,只用一个空指针的话直接就报错崩了,最后通过传值的形式把MainWindow传到了connect函数里。 出现ISO C++ forbids declaration of MainWindow with no type,需要在使用MainWindow的类的头文件里声明一下MainWind

2016-03-18 17:23:26 1735

原创 Linux_开发板通过NFS挂载到虚拟机的几个错误解决

这两天用想用开发板挂载到虚拟机的nfs服务器上,一直失败,错误提示为mount: mounting 192.168.134.198:/home/SKZH/Arm on /mnt failed: Input/output error然后找同学的机器挂在也无法挂载上,说明服务器出了问题,nfs服务器打开,防火墙也关了,于是就去查看了一下日志。cat /var/log/messages | grep mo

2016-03-17 20:25:12 4279

原创 Linux_嵌入式开发环境搭建

ubuntu搭建嵌入式开发环境开始载命令行模式下直接安装了一个arm-linux-gccsudo apt-get install gcc-arm-linux-gnueabi但是用这个编译了一个hello world的程序后无法在开发板上运行,提示./hello not found在ubuntu查看hello的链接库arm-linux-readelf -a hello | grep "Shared l

2016-03-03 11:38:14 1171

原创 Linux_自己编写一个who命令

1 分析 1.1 Linux的who命令可以做什么 通过who命令可以查看当前已登录的用户 1.2 linux的who命令是如何实现的 1.2.1 通过man获得信息 在命令行中输入man who在帮助文档中没有写出who是如何实现的,但是在最后 SEE ALSO The full documentation for who is maintained as a

2016-01-26 22:39:21 2365 1

原创 Linux_自己写一个more命令

1 分析 1.1 linux的more命令可以做什么? more命令可以分页显示文本的内容,首先显示出第一页的内容,然后按回车显示下一行,按空格显示下一页,按q退出,按h显示帮助。同时,在显示的最下方显示文件的百分比 1.2 more是如何实现的 由more的功能可知,首先先输出一页,然后输出文件百分比,等待用户的输入,根据用户的输入进行下一步操作。 2 自己动手写一个more命令 2.

2016-01-22 14:48:00 1853

原创 Linux_定制自己的vim

1、在自己的文件目录下新建一个.vimrc文件$ vim ~/.vimrc2、在其中添加以下代码set rtp+=~/.vim/bundle/vundle/call vundle#rc()Bundle 'gmarik/vundle'保存退出添加上述代码可以启用vundle来管理vim插件的功能3、从github上下载vim的插件管理插件vundlegit clone https://github

2016-01-21 20:46:20 434

原创 C_作用域、链接属性和储存类型

1.作用域 1.1 概述 变量在程序的某个部分声明时,只能在程序的一定区域内才能访问,这个区域就成为作用域。作用域分为四种——文件作用域、函数作用域、代码块作用域和原型作用域。编译器通过变量声明的位置来确定作用域 1.2 文件作用域 当变量在所有代码块之外声明时就在文件作用域中,文件作用域的范围是从变量声明处一直到文件的结束。但如果声明在“.h”文件中,并且该文件被其他文件用#include

2016-01-20 16:01:48 1723 1

原创 Linux_使用putty上传文件到linux系统

在windows命令行模式下使用pscp向远程linux服务器上传文件pscp -r -l root -pw 123 C:\Users\admin\Desktop\a.txt 123.123.123.123:/home-r 如果是一个文件夹则复制所有文件-l 用户名及密码(root)-pw 密码 (123)C:\Users\admin\Desktop\a.txt 所选的文件或文件夹123.

2015-11-17 22:39:19 1894

原创 C++_KMP算法的实现

#include <iostream>using namespace std;int* getNext(string b){ int len = b.length(); int *next = new int[len+1]; next[0] = next[1] = 0; int j = 0; //j始终表示长度为i-1的字符串的next值,即前一个

2015-10-20 22:38:32 534

原创 C++_队列的两种实现方法

通过数组表示#include <iostream>#define NULL 0using namespace std;class MyQueue{private: int *q; int front_, rear_,maxsize;public: MyQueue(int s) : maxsize(s+1) { q=new int(maxsize

2015-09-12 22:04:10 758

原创 C++_简单的链表栈

类中包含一个指针指向栈顶的元素,定义一个结构体,包括值和一个指向他上一个元素的指针,#include <iostream>#define NULL 0using namespace std;class MyStack{private: struct node { int s; node *link; }; node *top;p

2015-09-12 19:15:20 1955

原创 C++_子集生成算法汇总

增量构造算法每次递归选取一个值放入到集合中,每次递归也输出一遍 递归结束就是无法向集合中添加元素时#include <iostream>using namespace std;//cur用于确定子集的大小void print_subset(int *A,int n,int cur){ if(cur==0) cout << "kong"; for(int i = 0;i<cu

2015-09-12 10:16:32 6477 1

原创 C++_递归习题汇总

霍纳规则霍纳规则是一种使用最少数目的乘法在点x0处计算多项式的方法。如果一个多项式为A(x)=anxn+an-1xn-1+……+a1x+a0,则霍纳规则为: A(x0)=(…(anx0+an-1)x0+…+a1)x0+a0由公式可以看出括号内的部分即为递归的过程,最后递归的出口应为a0#include <iostream>using namespace std;int Horner(int *a,

2015-09-11 20:00:51 3755

原创 C++_递归排列产生器

含有n个元素的集合,共有n!中不同的排列。 先取出一个元素,然后将剩下n-1个元素排列,获得一种情况,然后取出另一个元素,将剩下n-1个元素排列,获得第二种情况,然后继续取出元素,直至第n个,而剩下的n-1个排列又可以产生n-1中情况,此时便完成了一次递归,也就是完成n-1的排列问题也就解决了n个元素的排列问题代码#include <iostream>using namespace std;voi

2015-09-10 20:55:56 655

数字图像处理-中科院课件.pdf

数字图像处理-中科院课件,和中科院的视频教材配套,可以

2018-03-31

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除