自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

博客

Code changes the world.

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

原创 LeetCode 858 Mirror Reflection

LeetCode 858 Mirror Reflection传送门题目分析 There is a special square room with mirrors on each of the four walls. Except for the southwest corner, there are receptors on each of the remaining co...

2018-06-24 19:58:21 1110

原创 LeetCode 859 Score of Parentheses

LeetCode 859 Score of Parentheses传送门题目分析 Given a balanced parentheses string S, compute the score of the string based on the following rule: () has score 1 AB has score A + B, wher...

2018-06-24 18:56:47 1158

原创 LeetCode 859 Buddy Strings

LeetCode 859 Buddy Strings传送门题目分析 Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B. Example 1: I...

2018-06-24 18:48:24 1555

原创 LeetCode 855. Exam Room

LeetCode 855. Exam Room传送门题目分析 In an exam room, there are N seats in a single row, numbered 0, 1, 2, ..., N-1. When a student enters the room, they must sit in the seat that maximizes t...

2018-06-17 17:13:43 2740

原创 LeetCode 853. Car Fleet

LeetCode 853. Car Fleet传送门题目分析 N cars are going to the same destination along a one lane road. The destination is target miles away. Each car i has a constant speed speed[i] (in miles ...

2018-06-17 16:49:24 1383

原创 LeetCode 842 Split Array into Fibonacci Sequence

LeetCode 842 Split Array into Fibonacci Sequence传送门题目分析 Given a string S of digits, such as S = "123456579", we can split it into a Fibonacci-like sequence [123, 456, 579]. Formally, a Fi...

2018-05-27 23:44:22 1448

原创 LeetCode 838 Push Dominoes

LeetCode 838 Push Dominoes传送门题目分析 There are N dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to th...

2018-05-24 11:27:31 1277

原创 LeetCode 829. Consecutive Numbers Sum

LeetCode 829 Consecutive Numbers Sum传送门题目分析 Given a positive integer N, how many ways can we write it as a sum of consecutive positive integers? Example 1: Input: 5Output: 2Expla...

2018-05-11 21:06:45 2280

原创 PAT 1016. Phone Bills (25)

PAT 1016. Phone Bills (25)题目分析原题相信大家都看见了,题目几乎不涉及算法,主要就是考大家的细心,题目大意就是给我们所有用户的长途电话记录,根据用户分组,计算每个用户需要交的电话费,打印账单,这个题隐含着如果一个用户没有一次完整的打电话记录就不输出,我起初在这个上面栽了跟头,后来及时更正了。解题逻辑读入花费的收费信息读入用户的信息,使用map将...

2018-05-08 19:12:41 184

原创 LeetCode 826 Most Profit Assigning Work

LeetCode 826 Most Profit Assigning Work传送门题目分析 We have jobs: difficulty[i] is the difficulty of the ith job, and profit[i] is the profit of the ith job. Now we have some workers. worke...

2018-04-29 17:08:04 727

原创 LeetCode 825 Friends Of Appropriate Ages

LeetCode 825 Friends Of Appropriate Ages传送门题目分析 Some people will make friend requests. The list of their ages is given and ages[i] is the age of the ith person. Person A will NOT frien...

2018-04-29 16:53:43 1518

原创 LeetCode 824 Goat Latin

LeetCode 824 Goat Latin传送门题目分析 A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to convert the sen...

2018-04-29 16:39:05 1009

原创 LeetCode 567 Permutation in String

LeetCode 567 Permutation in String传送门题目分析 Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string’s p...

2018-04-24 21:19:02 363

原创 LeetCode 820 Short Encoding of Words

LeetCode 820 Short Encoding of Words传送门题目分析 Given a list of words, we may encode it by writing a reference string S and a list of indexes A. For example, if the list of words is ["time"...

2018-04-23 20:57:48 869

原创 LeetCode 822 Card Flipping Game

LeetCode 821 Card Flipping Game传送门题目分析 On a table are N cards, with a positive integer printed on the front and back of each card (possibly different). We flip any number of cards, and ...

2018-04-23 20:28:53 830

原创 LeetCode 821 Shortest Distance to a Character

LeetCode 821 Shortest Distance to a Character传送门题目分析 Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. ...

2018-04-23 20:06:38 291

原创 LeetCode 807 Max Increase to Keep City Skyline

LeetCode 807 Max Increase to Keep City Skyline传送门题目分析 In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the h...

2018-03-25 22:30:48 807

原创 LeetCode 804 Unique Morse Code Words

LeetCode 804 Unique Morse Code Words传送门题目分析 International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "...

2018-03-25 22:22:55 860

原创 LeetCode 796 Rotate String

LeetCode 796 Rotate String传送门:LeetCode 796题目分析题目原文: We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost character to the rightmost posi...

2018-03-11 15:50:59 258

原创 Leetcode 318 Maximum Product of Word Lengths

Leetcode 318 Maximum Product of Word Lengths题目分析 Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You ma...

2018-03-10 10:36:23 291

原创 使用python为爬虫获取免费代理ip

免费代理ip的爬取 爬虫一直是python使用的一个重要部分,而许多网站也为此做了许多反爬措施,其中爬虫访问过于频繁直接封ip地址也作为一种“伤敌一千,自损八百”的方法被许多网站采用,代理ip便可以防止这种情况出现。搜索免费代理提供网站提供免费代理的网站直接百度还是有很多的,这里我就选取了西刺免费代理,选取了透明代理进行爬取。分析界面打开网址,可以看见ip很规则的排列...

2018-03-03 11:14:33 26396 1

原创 Huffman树的实现

最近复习的时候遇见了哈夫曼编码,虽然在数据结构和离散数学课上都见识到了这个编码树,不过今天时第一次动手写哈夫曼树,借助了c++的stl写起来还是比较简单的。话不多说,现在开始。1. 统计字符频率统计字符这个还是很简单的,首先我们要打开要处理的文件, // 输入的文件名 std::string file_name; std::cout << "Pleas...

2017-12-09 16:47:03 210

原创 Java编程思想之吸血鬼数

看Java编程思想的时候看到了这个吸血鬼数,感觉比较有意思就想写下来记录一下,我的这个是针对四位数的,更高的也可以适当向上拓展,我写的时候里面比较麻烦的就是结果重复问题了,用了个静态变量就好了,我的具体思想就是得到一个四位数,将它分开成4个数字,求全排列和全排列对应的值,这里面有重复数字的时候全排列就会重复,确实蛋疼,不过还是解决了。好吧,看代码吧。public class Main { p

2017-08-27 20:47:32 224

原创 c++string与数字的互转

c++string与数字的互转c++reference上面列举了一些方法。1.数字转string:数字转string,标准库里专门提供了函数: 包含的头文件 string,使用的话就是直接std::to_string(T para),会返回一个string,这个函数接受的参数可以是int、long、long long、及其unsigned,float、double、long d...

2017-08-13 09:44:50 2471

原创 Leetcode-033 Search in Rotated Sorted Array

今天我没事干,决定把好多天没写的Leetcode看一下,看到了33题,题目如下: 给定一个经过“旋转变换”的有序数组还有一个你要查找的目标数字,给出目标数字在数组中的下标,不存在则返回-1。例如给定{4, 5, 6, 7, 0, 1, 2, 3},6,函数返回值就应该是2。题目相信大家都能看懂,也都能想到一定的方法。那么接下来就一起探讨一下吧。第一种方法:最容易想到的也一定就是最笨的,那就是直

2017-08-12 16:32:45 175

转载 c++常量方法相关内容(转载)

本文总结了静态成员的使用、单例的实现、常量对象与常量方法,以及如何将常量方法重载为普通方法。静态成员对象成员的声明前加 static 即可定义为静态成员,静态成员必须在声明类的文件中进行声明(通常会初始化),否则链接错。 访问静态成员可以通过类名,也可以通过对象名。class CPerson{ static int count;};int CPerson::count = 0;CPers

2017-06-29 22:54:00 298

原创 Java使用正则表达式抓取Bing首页每日图片

Java学习到了正则表达式,总想做点有用的东西,这两天想给电脑换壁纸,看到Bing每天的主页图片挺好看的,就寻思着抓下来。 第一步就是分析主页的结构了这个Bing的主页图片直接使用小箭头抓是抓不到的,在Network的Img里我们可以找到图片所在处: 把链接copy下来,在Element里面搜索我们边可以看到链接是在一个JS脚本里面的,这个时候就比较清楚我们要怎么搞了, 链接所在的那...

2017-06-27 17:40:27 621

原创 PAT甲级1004CountingLeaves

A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Each input file contains one test case. Each case starts with a line

2017-04-24 12:49:38 226

原创 PAT甲级1009. Product of Polynomials (25)

计算多项式的乘积并输出看题目 This time, you are supposed to find A*B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occupies 2 lines, and each line

2017-03-09 21:19:15 229

原创 PAT甲级1008. Elevator (20)

求电梯运行的总时间简单不解释题目在这里 The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified

2017-03-09 21:03:38 180

原创 PAT甲级1005. Spell It Right

b( ̄▽ ̄)d ,水题一道,没有难度。看原题:Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains

2017-03-09 20:54:38 216

原创 PAT甲级1007. Maximum Subsequence Sum (25)

一道简单考察动态规划的题目。好了,我们先看题目吧。/*Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 <= i <= j <= K. The Maximum Subsequence is the co

2017-03-05 12:54:55 228

原创 PAT甲级1006. Sign In and Sign Out (25)

闲来无事刷道题吧。PAT1006,题目先贴上来 /*At the beginning of every day, the first person who signs in the computer room will unlock the door,and the last one who signs out will lock the door. Given the records of

2017-03-05 10:14:04 217

原创 Qt之QString

作为一名Qt初学者,有必要写一点东西记录下来自己的学习历程啊。Ok,看一下Qt的Qstring。1.QString的输入。 这个就是常见的=赋值就行了。 例:QString str= "Hello";对于这个语句,输入的是标准的C的”\0”结尾的字符串,Qt会将后面的字符串转换成Unicode编码存储。当超过128个字符时会使用QString::fromAscii()函数处理。2.QString的输

2017-03-02 20:51:39 757

原创 PAT甲级1002 A + B

PAT甲级1002这个问题讲的就是多项式加起来,根据题意设置一个数组把系数存储起来就好了,最后输出。 Talk is cheap, show me the code.//包含头文件#include <iostream>#include <cstdio>//需要保留小数点后一位,可以用%.1f,暂时还不会c++的标准输出#define MAXK 1001 //在数组中使用using names

2017-02-19 11:13:25 258

华科数据结构AVL树课设

华中科技大学数据结构的基于AVL树的课程设计,要求实现Set集合和人物之间的关系操作。

2018-03-11

空空如也

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

TA关注的人

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