自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(86)
  • 资源 (12)
  • 收藏
  • 关注

原创 浙大pat | 浙大pat乙级 1001~1004

1001A+B和C (15)题目描述给定区间[-2的31次方, 2的31次方]内的3个整数A、B和C,请判断A+B是否大于C。输入描述:输入第1行给出正整数T(,是测试用例的个数。随后给出T组测试用例,每组占一行,顺序给出A、B和C。整数间以空格分隔。输出描述:对每组测试用例,在一行中输出“Case

2018-01-31 19:36:50 419

原创 LeetCode | 761. Special Binary String 最优子结构难题

Special binary strings are binary strings with the following twoproperties:· The number of 0's is equal to the number of 1's.· Every prefix of the binary string has at least as many 1's as 0's.G

2018-01-31 19:26:01 1222

原创 LeetCode | 506. Relative Ranks

Givenscores of N athletes, find their relative ranks and the people with thetop three highest scores, who will be awarded medals: "Gold Medal","Silver Medal" and "Bronze Medal".Example1:Input:

2018-01-31 19:23:40 116

原创 LeetCode | 371. Sum of Two Integers不用加号做加法

Calculate the sum of two integers a and b,but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.Credits:Special thanks to @fujiaozhu foradding this proble

2018-01-31 19:22:45 409

原创 读书 | 少有人走的路心智成熟的旅程读后感

少有人走的路,心智成熟的旅程1.父母的爱书中说,精神分裂症患者的母亲,往往是典型的自恋狂。这句话我很有体会。有些父母总是觉得他们的子女应该和他们有一样的感受,他们从来不去体会别人的,甚至是他们子女的感受,总是觉得他们的子女应该有什么样的感受,而不是觉得他们的子女实际上的感受。很多父母总是从小拼命的指责他们的子女,然后觉得他们的子女肯定能感受到自己的一片好心,指望着自己的子女将来去感

2018-01-30 17:04:08 2534

原创 经典算法 | 给定n个矩形,判断这些矩形是否在不重合的情况下组成一个大矩形的算法

GivenN axis-aligned rectangles where N > 0, determine if they all together forman exact cover of a rectangular region.Eachrectangle is represented as a bottom-left point and a top-right point. Forex

2018-01-30 17:01:23 3114 1

原创 LeetCode | 391. Perfect Rectangle矩形覆盖难题

GivenN axis-aligned rectangles where N > 0, determine if they all together forman exact cover of a rectangular region.Eachrectangle is represented as a bottom-left point and a top-right point. Forex

2018-01-30 16:55:21 1028

原创 LeetCode | 372. Super Pow 数学原理题

Yourtask is to calculate ab mod 1337 where a is a positive integer and b isan extremely large positive integer given in the form of an array.Example1:a = 2b = [3] Result: 8Example2

2018-01-30 16:51:24 165

原创 LeetCode | 6. ZigZag Conversion 循环技巧题

Thestring "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows likethis: (you may want to display this pattern in a fixed font for betterlegibility)P   A   H   NA P L S I

2018-01-30 16:50:01 138

原创 LeetCode | 121. Best Time to Buy and Sell Stock循环技巧题

Sayyou have an array for which the ith element is the price of a given stock on day i.Ifyou were only permitted to complete at most one transaction (ie, buy one andsell one share of the stock), de

2018-01-30 16:49:14 120

原创 LeetCode | 55. Jump Game循环技巧题

Given an array of non-negative integers, you are initiallypositioned at the first index of the array.Each element in the array represents your maximum jump length atthat position.Determine if you

2018-01-30 16:47:50 135

原创 LeetCode | 45. Jump Game IIDP或贪心难题

Given an array of non-negative integers, you are initiallypositioned at the first index of the array.Each element in the array represents your maximum jump length atthat position.Your goal is to r

2018-01-26 12:54:42 231

原创 经典算法 | 大数相乘,给定两个string表示的大数,输出相乘的结果,给定的数和结果都用字符串表示

大数相乘算法经常遇到的题吧,按照用笔做乘法的顺序去做大数相乘就好了,就是处理起来比较麻烦,也只是麻烦而已class Solution {public: string multiply(string num1, string num2) { if (num1 == "0" || num2 =="0") return "0"; int n1 = num1.s

2018-01-26 12:51:05 1139

原创 LeetCode | 43. Multiply Strings大数相乘

Giventwo non-negative integers num1 and num2 representedas strings, return the product of num1 and num2.Note:1.      The length of both num1 and num2 is< 110.2.      Both num1 and num2 conta

2018-01-26 12:49:36 228

原创 LeetCode | 48. Rotate Image矩阵翻转

Youare given an n x n 2D matrix representing an image.Rotatethe image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you have to modify theinput 2D matrix di

2018-01-26 12:48:13 156

原创 给定n个数组编号1~n,给定一个范围,使得这个范围包含第k个数组至少ak个数的算法

这题给你许多个数组,让你给出一个范围,这个范围里面包含每个数组至少一个数,并且使这个范围尽可能的小。包含第k个数组ak个数的算法解决方法和本题一模一样使得这个范围里面包含每个数组至少m个数也可以适用相同的方法解决,只需要修改一个值就行了。这题是使用贪心算法的思想解决的。首先把所有数组里面的值都混合在一起,组成一个数组theMark,然后排序,混合之后的数组为pair类型的数组,pa

2018-01-26 12:47:07 709

原创 LeetCode | 632. Smallest Range求多个数组拥有最小范围的一个交集难题

Youhave k lists of sorted integers in ascending order. Find the smallest rangethat includes at least one number from each of thek lists.Wedefine the range [a,b] is smaller than range [c,d] if b-a

2018-01-26 12:43:10 593 1

原创 LeetCode | 76. Minimum Window Substring多区域覆盖难题

Given a string S and a string T, find the minimum window in Swhich will contain all the characters in T in complexity O(n).For example,S = "ADOBECODEBANC"T = "ABC"Minimum window is "BANC".No

2018-01-26 12:42:16 184

原创 LeetCode | 695. Max Area of Island BFS

Givena non-empty 2D array grid of0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontalor vertical.) You may assume all four edges of the grid are surroun

2018-01-26 12:39:22 172

原创 LeetCode | 684. Redundant Connection 拓扑排序中等难度

Inthis problem, a tree is an undirected graph that is connected and has no cycles.Thegiven input is a graph that started as a tree with N nodes (with distinctvalues 1, 2, ..., N), with one additio

2018-01-26 12:37:44 314

原创 LeetCode | 673. Number of Longest Increasing Subsequence中等偏难题 找寻数组里面最大长度的子串的个数

Givenan unsorted array of integers, find the number of longest increasingsubsequence.Example1:Input: [1,3,5,4,7]Output: 2Explanation: The two longest increasing subsequenceare [1, 3, 4, 7] and [1, 3,

2018-01-18 17:58:36 219

原创 LeetCode | 764. Largest Plus Sign中等偏难 二维数组找规律题

Ina 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the givenlist mines which are 0. What is the largest axis-aligned plus sign of 1s contained in the grid? Return th

2018-01-18 17:56:51 1084

原创 LeetCode | 763. Partition Labels 中等偏难贪心算法 把一个字符串划分为有独立字母的最多组的划分方法

Astring S of lowercase letters is given. We want to partition thisstring into as many parts as possible so that each letter appears in at mostone part, and return a list of integers representing the s

2018-01-18 17:55:04 2530

原创 LeetCode | 762. Prime Number of Set Bits in Binary Representation 简单题 二进制技巧题

Giventwo integers L and R, find the count of numbers in therange [L, R] (inclusive) having a prime number of set bits in their binaryrepresentation.(Recallthat the number of set bits an integer has is

2018-01-18 17:53:34 200

原创 经典算法 | 给定n个集合,求解一个范围,使得这个范围包含每个集合至少m个数

这题给你许多个数组,让你给出一个范围,这个范围里面包含每个数组至少一个数,并且使这个范围尽可能的小。使得这个范围里面包含每个数组至少m个数也可以适用相同的方法解决,只需要修改一个值就行了。这题是使用贪心算法的思想解决的。首先把所有数组里面的值都混合在一起,组成一个数组theMark,然后排序,混合之后的数组为pair类型的数组,pair第一个值表示得到的这个值属于几号数组,第二个值才真正表示假如混

2018-01-18 17:51:18 2198

原创 LeetCode | 141. Linked List Cycle 寻找链表中的环,简单题

Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题目是判断链表里面是否有循环,可以使用快慢指针解决,实际上只要是判断循环的题目都可以使用快慢指针解决,慢指针每一次走一格,快指针每一次走两格,当快指针为null的时候肯

2018-01-17 13:29:53 206

原创 LeetCode | 463. Island Perimeter 寻找像素点边缘简单题

You are given a map in form of a two-dimensional integer gridwhere 1 represents land and 0 represents water. Grid cells are connectedhorizontally/vertically (not diagonally). The grid is completely su

2018-01-17 13:28:29 163

原创 LeetCode | 566. Reshape the Matrix 简单矩阵循环题

InMATLAB, there is a very useful function called 'reshape', which can reshape amatrix into a new one with different size but keep its original data.You'regiven a matrix represented by a two-dimensio

2018-01-17 13:26:29 202

原创 优化算法 | N皇后问题启发式算法局部搜索

传统的n后问题使用的是回溯法解决的,但是一旦问题的规模过大,那么计算时间复杂度是不能够接受的,这里有一种启发式局部搜索的n皇后问题,由sosic和顾均提出,可以计算皇后数量超过1000,当皇后数量超过1000的时候,计算时间反而会下降,每一次运行的时间为O(n^2),算法伪代码为输入:皇后数量N输出:解t(i)BeginDo(1)  产生一个随机解t(i)(i=1,2,3,

2018-01-17 13:24:17 3718

原创 经典算法 | 求解数组中的4个数的和为指定数的所有组合

给你一个数,问你数组中的哪四个数的和为指定的target,这四个数不允许出现重复的数。这一题并不难,但是非常的复杂,首先设定一个i和j,遍历i和j之间的所有数,这个过程并难,但是剪枝比较复杂,并且为了防止出现重复的数,需要使用非常复杂的过滤函数首先需要对数组进行排序,实际上很多涉及到数组的题目都首先需要对数组进行排序,能够节省很多的时间,首先是if (nums[i] +nums[i

2018-01-17 13:21:14 4265

原创 经典算法 | 使用DP求解数组中最长子序列的个数

这是一道最长子序列题,子序列中的每一个数在原序列中不一定是相邻的,这一点要注意,用dp 解决,用dp[i]记录最后一个数字为nums[i]的最长子序列长度,用count[i]记录最后一个数字为nums[i]的最长子序列个数,dp[i]=max(dp[j]+1),{j| j=0,1,2…i-1&&nums[j]count[i]=所有count[j]之和if(dp[j]+1==dp[i])

2018-01-17 11:59:52 638

原创 经典算法 | 判断任意长度链表是否有环的O(n)时间,O(1)空间算法

题目是判断链表里面是否有循环,可以使用快慢指针解决,实际上只要是判断循环的题目都可以使用快慢指针解决,慢指针每一次走一格,快指针每一次走两格,当快指针为null的时候肯定不存在循环了,当链表中有循环则一定有一次循环会使得快指针等于慢指针计算出环所需要的总步数为,慢指针走到循环入口处所需要的步数和这个时候快指针和慢指针的距离的和(因为在环里面慢指针每次走一步,快指针每次走两步,他们的距离每次

2018-01-16 12:59:34 974

原创 经典算法 | 求长度为n数组中所有出现次数多于⌊ n/m ⌋的所有数的O(n)时间,O(1)空间算法

求数组中多于一半的或者是多于1/3的全部数字都可以用这种方法解决这里给你一个数组,要你求出所有出现数量多于 ⌊ n/3⌋的数字,这题方法简单,但是原理非常复杂,,首先用两个数a,b,n1,n2来分别记录峰1,峰2,峰1的数量,峰2的数量,可以证明,当求 所有多于⌊ n/m ⌋的数的时候,只要定义(m-1)个不同的数字,以及(m-1)个不同的计数,将所有计数初始化为0,所有数字初始化为不同值

2018-01-13 14:22:07 727

原创 经典算法 | 给定数轴上点,寻找一个点到其他点的距离之和最小

给你一个数轴上的许多个点,让你寻找一个点A,使得A到其他所有数轴上的点的距离之和最短 毫无疑问,当数轴上的点的数量是偶数的时候,A取在数轴上所有点按照其坐标排列,排在最中间的两个点中间, 当数轴上的点的数量是奇数的时候,A取这些所有点按照其坐标排列,排在最中间的点当取好A之后求所有点到其距离之和即可  代码如下class Solution {public: int m

2018-01-13 14:16:33 19625 2

原创 LeetCode | 689. Maximum Sum of 3 Non-Overlapping Subarrays 困难DP题分析与解答

Ina given array nums ofpositive integers, find three non-overlapping subarrays with maximum sum.Eachsubarray will be of size k, and we want to maximize the sum of all 3*k entries.Returnthe resul

2018-01-13 13:45:34 734

原创 LeeCode | 41. First Missing Positive限定时间空间困难技巧题

Given an unsorted integer array, find the first missing positiveinteger.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n)time and uses constant space

2018-01-13 13:44:26 126

原创 575. Distribute Candies 简单数学题

Given an integer array with even length, where different numbers in thisarray represent different kinds of candies. Each number means one candy of the correspondingkind. You need to distribute the

2018-01-13 13:43:15 223

原创 LeetCode | 347. Top K Frequent Elements 优先队列技巧题

Givena non-empty array of integers, return the k mostfrequent elements.Forexample,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always valid, 1 ≤ k ≤ number of uniq

2018-01-13 13:42:15 294

原创 LeetCode | 554. Brick Wall map技巧题

Thereis a brick wall in front of you. The wall is rectangular and has several rowsof bricks. The bricks have the same height but different width. You want todraw a vertical line from the top to the 

2018-01-13 13:40:43 262

原创 LeetCode | 258. Add Digits 数字位数相加简单数学技巧题

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

2018-01-13 13:40:04 218

用于求解一元四次方程的类的头文件

用于求解一元四次方程的类的头文件, //pr[5]分别表示一元四次方程的5个参数,pr[0] * x^4 + pr[1] * x^3 + pr[2] * x^2 + pr[3] * x^1 + pr[4] = 0 //使用EquationSolver MyES; double prs = {1,1,1,1,1}; MyES.solve(prs); 来求解 //MyES.slnum表示解的个数,MyES.sl中存储着每一个解,这里只计算实数解

2018-06-04

C++实现多元线性回归 可指定任意几元 训练给出回归方程式

控制台应用程序,C++实现多元线性回归,可指定任意几元,根据给定的数据矩阵,训练给出回归方程式

2018-05-23

C#实现复数类,包括加减乘除乘方开方N次方等操作

C#实现复数类,包括加减乘除乘方开方N次方等操作,封装在一个类里面,可以直接调用

2018-04-19

OpenGl C++太阳系小行星运行系统 可切换视角

OpenGL C++开发太阳系小行星运行系统 小行星围绕太阳转动 wasdx按键可切换视角显示

2018-03-25

计算理论导论电子书

计算理论导论电子书,计算理论导论电子书,这门课程的电子书

2017-10-05

2016杭电研究生入学笔试题回忆

2016杭电研究生入学笔试题回忆,2016杭电研究生入学笔试题回忆

2017-10-05

qt_vs2015_addin 2.0.0

QT对于vs2015的addin

2017-04-28

cmake解析cgal选定目标文件夹成功后生成的库文件包

cmake选定cgal源文件夹 目标文件夹 成功congifure后gerenate后生长的文件包 用的cgal4.9 cmake 3.8 qt 5.8 boost 1.59

2017-04-27

winform c#开发的导入图片 处理图片 导出图片的小程序

C# winform 开发的图像滤镜处理小程序 可以导入图片 然后处理图片 可以显示处理前后的对照图片,外加将处理完成后的图片导出的功能

2015-05-05

WPF制作可以拖动的图片框源码

WPF制作可以拖动的图片框源码 把鼠标移上去按下鼠标左键可以拖动图片框

2014-06-25

WPF 通过输入的时间绘制时钟时针的位置源码

WPF 通过输入的时间绘制时钟时针的位置源码 随便写的WPF程序

2014-06-20

WPF 指针型仿QQ小时钟源码

Q版小时钟WPF源码 全部用xaml代码写成 很漂亮的指针型小时钟

2014-06-20

空空如也

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

TA关注的人

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