自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

菜鸟干戈的博客

我是菜鸟程序员干戈,大家一起加油吧!

  • 博客(47)
  • 资源 (15)
  • 收藏
  • 关注

原创 学习总结 求某年某月某日之后第N天日期的解法

一个求解某年某月某日之后第N天日期算法的代码,值得一看。

2017-04-20 22:42:07 566

原创 LeetCode 004 Median of Two Sorted Arrays

There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1:nums1 =

2017-04-17 08:02:35 257

原创 LeetCode 070 Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a posi

2017-04-16 20:18:41 208

原创 LeetCode 026 Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with

2017-04-16 19:09:59 242

原创 LeetCode 412 Fizz Buzz

Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”.

2017-04-16 09:04:02 204

原创 LeetCode 260 Single Number III

Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:Given 

2017-04-14 23:05:16 163

原创 LeetCode 125 Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a

2017-04-14 22:43:04 151

原创 LeetCode 118 Pascal's Triangle

Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]AC代码如下:class Solution {pu

2017-04-14 16:47:55 164

原创 LeetCode 461 Hamming Distance

The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note:0 ≤ x, 

2017-04-13 21:01:38 146

原创 LeetCode 066 Plus One

Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The digi

2017-04-12 23:38:18 230

原创 LeetCode 153 Find Minimum in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no

2017-04-11 13:52:46 199

原创 LeetCode 190 Reverse Bits

Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110010

2017-04-11 12:53:21 318

原创 LeetCode 557 Reverse Words in a String III

Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take LeetCode contes

2017-04-09 23:24:00 153

原创 LeetCode 027 Remove Element

Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.

2017-04-07 20:46:32 147

原创 LeetCode 203 Remove Linked List Elements

Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5AC代码如下:/** * Definiti

2017-04-07 20:33:04 178

原创 LeetCode 344 Reverse String

Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".AC代码如下:class Solution {public: string reverseString(string s) {

2017-04-07 15:43:44 161

原创 LeetCode 268 Missing Number

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:Your algorithm sho

2017-04-07 15:13:32 144

原创 LeetCode 283 Move Zeroes

Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling you

2017-04-07 15:04:03 141

原创 LeetCode 021 Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.AC代码如下:/** * Definition for singly-linked list. * s

2017-04-07 09:59:08 154

原创 LeetCode 083 Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.AC代码如下:/** * Definit

2017-04-06 23:19:23 220

原创 九度OJ 1151 位操作练习

时间限制:1 秒内存限制:32 兆特殊判题:否提交:1986解决:1109题目描述:给出两个不大于65535的非负整数,判断其中一个的16位二进制表示形式,是否能由另一个的16位二进制表示形式经过循环左移若干位而得到。循环左移和普通左移的区别在于:最左边的那一位经过循环左移一位后就会被移到最右边去。比如:1011 0000 000

2017-04-01 22:50:11 248

原创 LeetCode 191 Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 000000

2017-04-01 18:17:54 191

原创 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 -> 1 B -> 2 C -> 3 ...

2017-04-01 17:14:30 209

原创 LeetCode 034 Search for a Range

Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the

2017-04-01 12:10:30 173

原创 LeetCode 035 Search Insert Position

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.

2017-04-01 11:57:51 137

原创 LeetCode 100 Same Tree

Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.AC代码如下:

2017-03-31 20:08:03 341 3

原创 PAT-甲级 1101 Quick Sort

1101. Quick Sort (25)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CAO, PengThere is a classical process named partition in

2017-03-31 19:22:44 553 2

原创 LeetCode 231 Power of Two

Given an integer, write a function to determine if it is a power of two.AC代码如下:class Solution {public: bool isPowerOfTwo(int n) { if(n<=0) return false; int count=

2017-03-31 18:26:46 152

原创 LeetCode 204 Count Primes

Description:Count the number of prime numbers less than a non-negative number, n.AC代码如下:class Solution {public: int countPrimes(int n) { int ret=0; if(n<=2)

2017-03-31 17:03:40 142

原创 LeetCode 058 Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is

2017-03-31 13:45:08 151

原创 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?AC代码如下:/** * Definition for singly-linked list. * struct ListNode { * int

2017-03-31 13:26:12 205

原创 LeetCode 136 Single Number

Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using e

2017-03-31 12:39:41 140

原创 LeetCode 001 Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the sam

2017-03-30 23:20:29 169

原创 PAT-乙级 1007 素数对猜想

1007. 素数对猜想 (20)时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue让我们定义 dn 为:dn = pn+1 - pn,其中 pi 是第i个素数。显然有 d1=1 且对于n>

2017-03-30 20:36:22 146

原创 PAT-甲级 1128 N Queens Puzzle

1128. N Queens Puzzle (20)时间限制300 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe "eight queens puzzle" is the problem o

2017-03-30 14:14:53 334

原创 PAT-乙级 1057 数零壹

1057. 数零壹(20)时间限制200 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue给定一串长度不超过105的字符串,本题要求你将其中所有英文字母的序号(字母a-z对应序号1-26,不分大小写)相

2017-03-30 14:07:02 193

原创 PAT-乙级 1056 组合数的和

1056. 组合数的和(15)时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue给定N个非0的个位数字,用其中任意2个数字都可以组合成1个2位的数字。要求所有可能组合出来的2位数字的和。例

2017-03-30 14:02:07 275

原创 PAT-乙级 1069 微博转发抽奖

1069. 微博转发抽奖(20)时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue小明PAT考了满分,高兴之余决定发起微博转发抽奖活动,从转发的网友中按顺序每隔N个人就发出一个红包。请你编

2017-03-30 13:47:25 250

原创 PAT-乙级 1070 结绳

1070. 结绳(25)时间限制200 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue给定一段一段的绳子,你需要把它们串成一条绳。每次串连的时候,是把两段绳子对折,再如下图所示套接在一起。这样得到的绳

2017-03-29 20:02:50 883

原创 PAT-乙级 1021 个位数统计

1021. 个位数统计 (15)时间限制100 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue给定一个k位整数N = dk-1*10k-1 + ... + d1*101 + d0 (0i<=9, i=

2017-03-29 19:58:20 192

操作系统页面内存页面置换算法(OPT、LRU、FIFO以及Clock)的实现程序

实现OPT、LRU、FIFO以及Clock四种不同的页面置换策略,界面良好

2013-12-12

银行家算法实现程序

用java写的一个操作系统中实现银行家算法的程序,界面良好

2013-12-12

微信飞机大战模仿程序

用java写的一个模仿微信飞机大战的程序,包含所有图片素材

2013-12-12

计算机组成与设计 第四版答案

计算机组成与设计 第四版答案 英文原版

2013-09-11

算法导论第三版答案

包含了算法导论第三版的练习题答案,英文原版

2013-09-10

QT VS2010 坦克大战

这个程序用安装了QT插件的VS2010编写的坦克大战程序,实现了经典坦克大战的绝大部分功能,虽然有点小Bug,但整体效果还不错,实现的功能有: 1.己方坦克、己方子弹的控制 2.敌方坦克、敌方子弹的智能移动 3.炸弹、定时器等经典元素的加入 4.水泥墙、砖墙、水池、灌木丛等经典元素的加入,墙体也会随着子弹的打击而发生变化 5.炸弹发生后的效果以及敌方坦克再生后的效果 6.音效的加入 7.大量的坦克大战图片素材 如果下载后不能运行,请新建一空程序并把这里面的源文件导入,就可以解决这个问题了。

2013-08-28

网页制作入门教程

不错的网页开发基础教程,简单易懂,适合初学者。

2013-08-22

简单商品订购管理软件

综合运用了C++编程技术和数据结构知识,用VS2010实现一个简单的商品订购管理软件,该软件能够模拟实现简单的库存、订购、发货等功能。

2013-08-22

城市之间最短路径管理软件

综合运用了C++编程技术和Dijkstra算法和Floyd算法,用VS2010设计实现一个简单的城市之间最短路径管理软件,该软件能够模拟实现简单的路径维护、求解单源最短路径、求解所有节点间最短路径等功能。

2013-08-22

基于windows窗体程序的稀疏矩阵显示及相加

基于windows窗体程序的稀疏矩阵,可以即时显示稀疏矩阵的非零元素,也可以即时插入非零元素,界面良好,同时实现了两个稀疏矩阵的加法

2013-05-08

可以聊天的小软件

比较智能聊天的小软件,c++ windows窗体程序

2013-05-03

稀疏矩阵 c++ 三元组表

基于windows窗体程序的三元组表的稀疏矩阵

2013-05-03

傻瓜计算器

实现了加减乘除四则运算,左右括号的实现,界面良好,求幂以及累乘的实现, 历史记录的实现

2013-04-23

猴子选大王程序

猴子选大王解决程序 C++ cmd

2013-04-16

多项式相加 C++ 链表的应用

多项式相加 C++ 链表的应用 cmd

2013-04-16

空空如也

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

TA关注的人

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