自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(94)
  • 资源 (1)
  • 收藏
  • 关注

原创 《深入探索C++对象模型》之二

前言:       C++语言编译过程中,编译器会背着程序员做了很多工作,其中默认构造函数就是其中一件工作,透彻熟悉C++默认构造函数在何种情形下会生成,以及其作用是什么,对于C++程序员来是至关重要的。下面详细介绍C++构造语意学。1、 Default Constructor的建造操作        只有在编译器需要的时候才会合成一个default constructor,且被合成的defaul...

2018-04-26 16:04:53 468

原创 《深入探索C++对象模型》之一

前言:        由于经常使用C++,但是又对C++内部机制不是很深入了解,所以看了一些关于C++的经典书籍,其中有《C++ Primer》、《STL源码剖析》、《Efficitive C++》、《More Efficitive C++》。《C++ Primer》特别适合刚使用C++的程序员学习,里面详细介绍了一些C++基础知识,包括流和STL容器、适配器、算法还有C++的面向对象的一些知识。...

2018-04-26 09:54:36 8408 1

原创 LeetCode 235: Lowest Common Ancestor of a Binary Search Tree

题目链接:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/description/描述Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.Acc

2018-01-02 11:42:04 250

原创 LeetCode 231: Power of Two

题目链接:https://leetcode.com/problems/power-of-two/description/描述Given an integer, write a function to determine if it is a power of two.算法思想:算法1:使用递归算法,退出的条件是:当n == 1时,返回true;当n≤0时,返回false。然后递归调用isPowerO

2018-01-01 17:25:25 250

原创 LeetCode 198: House Robber

题目链接:https://leetcode.com/problems/house-robber/description/描述You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint

2017-12-30 22:27:31 157

原创 LeetCode 172: Factorial Trailing Zeroes

题目链接:https://leetcode.com/problems/factorial-trailing-zeroes/description/描述Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.算法

2017-12-30 14:01:18 148

原创 LeetCode 169: Majority Element

题目链接:https://leetcode.com/problems/majority-element/description/描述Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may a

2017-12-30 12:57:59 210

原创 题目117:求逆序数

题目链接:http://59.69.128.203/JudgeOnline/problem.php?pid=117描述在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。现在,给你一个N个元素的序列,请你判断出它的逆序数是多少。比如 1 3 2 的逆序数就是1。输入第一行输入一个整数T表示测试数据的组数(1<=

2017-12-23 21:35:39 829

原创 题目90:整数划分

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=90描述将正整数n表示成一系列正整数之和:n=n1+n2+…+nk, 其中n1≥n2≥…≥nk≥1,k≥1。 正整数n的这种表示称为正整数n的划分。求正整数n的不 同划分个数。 例如正整数6有如下11种不同的划分: 6; 5+1; 4+2,4+1+1; 3+3,

2017-11-28 23:38:31 597

原创 题目104:最大和

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=104描述给定一个由整数组成二维矩阵(r*c),现在需要找出它的一个子矩阵,使得这个子矩阵内的所有元素之和最大,并把这个子矩阵称为最大子矩阵。 例子: 0 -2 -7 0 9 2 -6 2 -4 1 -4 1 -1 8 0 -2 其最大子矩阵为:9 2 -4 1

2017-11-28 23:10:37 593

原创 题目68:三点顺序

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=68描述现在给你不共线的三个点A,B,C的坐标,它们一定能组成一个三角形,现在让你判断A,B,C是顺时针给出的还是逆时针给出的?如:图1:顺时针给出图2:逆时针给出 输入每行是一组测试数据,有6个整数x1,y1,x2,y2,x3,y3分别表示A,B,C三个点的横纵坐标。(坐标值都在0到10

2017-11-22 23:21:35 316

原创 题目54:小明的存钱计划

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=54描述小明的零花钱一直都是自己管理。每个月的月初妈妈给小明300元钱,小明会预算这个月的花销,并且总能做到实际花销和预算的相同。 为了让小明学习如何储蓄,妈妈提出,小明可以随时把整百的钱存在她那里,到了年末她会加上20%还给小明。因此小明制定了一个储蓄计划:每个月的月初,在得到妈妈给的零

2017-11-10 00:21:38 542

原创 LeetCode 160: Intersection of Two Linked Lists

题目链接:https://leetcode.com/problems/intersection-of-two-linked-lists/description/描述Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following

2017-11-08 22:16:58 153

原创 LeetCode 349: Intersection of Two Arrays

题目链接:https://leetcode.com/problems/intersection-of-two-arrays/description/描述Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return

2017-11-04 19:34:24 199

原创 LeetCode 155: Min Stack

题目链接:https://leetcode.com/problems/min-stack/description/描述Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack. pop() –

2017-11-02 20:01:05 167

原创 LeetCode 137: Single Number II

题目链接:https://leetcode.com/problems/single-number-ii/description/描述Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one.Note: Y

2017-11-01 14:35:17 195

原创 LeetCode 121: Best Time to Buy and Sell Stock

题目链接:https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/描述Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to com

2017-10-31 21:26:56 179

原创 LeetCode 120: Triangle

题目链接:https://leetcode.com/problems/triangle/description/描述Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given

2017-10-31 20:28:49 166

原创 LeetCode 136:Single Number

题目链接:https://leetcode.com/problems/single-number/description/描述Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear ru

2017-10-31 08:24:03 511

原创 LeetCode 32:Longest Valid Parentheses

题目链接:https://leetcode.com/problems/longest-valid-parentheses/description/描述Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses subs

2017-10-28 14:02:33 172

原创 Leetcode 60: Permutation Sequence

题目链接:https://leetcode.com/problems/permutation-sequence/description/描述The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order, We get th

2017-10-27 16:31:56 182

原创 LeetCode 67: Add Binary

题目链接:https://leetcode.com/problems/add-binary/description/描述Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.输入输入两个字符串,a和b,求二进制和并以字符串形式返回。

2017-10-27 07:59:40 129

原创 LeetCode 69: Sqrt(x)

题目链接:https://leetcode.com/problems/sqrtx/description/描述Implement int sqrt(int x).Compute and return the square root of x.输入输入一个自然数输出输出该自然数的平方根(最接近的)样例输入16 18样例输出4 4算法思想:这道题使用到了本科学过的数值分析,可以使用牛顿迭代法,非常经

2017-10-26 20:40:18 188

原创 题目84:阶乘的0

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=84描述计算n!的十进制表示最后有多少个0输入第一行输入一个整数N表示测试数据的组数(1<=N<=100) 每组测试数据占一行,都只有一个整数M(0<=M<=10000000)输出输出M的阶乘的十进制表示中最后0的个数 比如5!=120则最后的0的个数为1样例输入6 3 60 100

2017-10-24 18:41:43 501

原创 题目33:蛇形填数

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=33描述在n*n方陈里填入1,2,…,n*n,要求填成蛇形。例如n=4时方陈为: 10 11 12 1 9 16 13 2 8 15 14 3 7 6 5 4输入直接输入方陈的维数,即n的值。(n<=100)输出输出结果是蛇形方陈。样例输入3样例输出7 8 1 6 9 2 5 4

2017-10-23 18:35:29 218

原创 题目5:Binary String Matching

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=5描述Given two strings A and B, whose alphabet consist only ‘0’ and ‘1’. Your task is only to tell how many times does A appear as a substring of B?

2017-10-20 21:01:21 310

原创 题目88:汉诺塔(一)

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=88描述在印度,有这么一个古老的传说:在世界中心贝拿勒斯(在印度北部)的圣庙里,一块黄铜板上插着三根宝石针。印度教的主神梵天在创造世界的时候,在其中一根针上从下到上地穿好了由大到小的64片金片,这就是所谓的汉诺塔。不论白天黑夜,总有一个僧侣在按照下面的法则移动这些金片:一次只移动一片,不管在哪

2017-10-20 20:27:49 369

原创 题目51:管闲事的小明

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=51描述某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米。我们可以把马路看成一个数轴,马路的一端在数轴0的位置,另一端在L的位置;数轴上的每个整数点,即0,1,2,……,L,都种有一棵树。   由于马路上有一些区域要用来建地铁。这些区域用它们在数轴上的起始点和终止点表示。

2017-10-20 16:01:33 216

原创 题目45:棋盘覆盖

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=45描述在一个2^k × 2^k(1<=k<=100)的棋盘中恰有一方格被覆盖,如图1(k=2时),现用一缺角的2×2方格(图2为其中缺右下角的一个),去覆盖2k×2k未被覆盖过的方格,求需要类似图2方格总的个数s。如k=1时,s=1;k=2时,s=5 输入第一行m表示有m组测试数据; 每

2017-10-18 18:51:24 503

原创 Leetcode 79:Word Search

题目链接:https://leetcode.com/problems/word-search/description/描述Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, whe

2017-10-18 11:08:30 168

原创 题目927:The partial sum problem

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=927描述One day,Tom’s girlfriend give him an array A which contains N integers and asked him:Can you choose some integers from the N integers and the

2017-10-14 20:20:16 179

原创 题目1058:部分和问题

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=1058描述给定整数a1、a2、…….an,判断是否可以从中选出若干数,使它们的和恰好为K。输入首先,n和k,n表示数的个数,k表示数的和。 接着一行n个数。 (1<=n<=20,保证不超int范围)输出如果和恰好可以为k,输出“YES”,并按输入顺序依次输出是由哪几个数的和组成,否则“N

2017-10-14 19:58:19 260

原创 题目738:Calendar Game

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=738描述Adam and Eve enter this year’s ACM International Collegiate Programming Contest. Last night, they played the Calendar Game, in celebration of

2017-10-14 17:08:25 213

原创 题目635:Oh, my goddess

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=635描述Shining Knight is the embodiment of justice and he has a very sharp sword can even cleavewall. Many bad guys are dead on his sword.One day, tw

2017-10-13 16:05:03 213

原创 题目36:数的长度

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?cid=330&cpid=36描述N!阶乘是一个非常大的数,大家都知道计算公式是N!=N*(N-1)······*2*1.现在你的任务是计算出N!的位数有多少(十进制)?输入首行输入n,表示有多少组测试数据(n<10) 随后n行每行输入一组测试数据 N( 0 < N < 1000000 )输出对于每

2017-10-12 19:20:51 215

原创 C++(C)数字四舍五入函数

/* round vs floor vs ceil vs trunc */#include <stdio.h> /* printf */#include <math.h> /* round, floor, ceil, trunc */int main (){ const char * format = "%.1f \t%.1f \t%.1f \t%.1f \t%.1f

2017-10-12 14:27:42 3595

原创 题目483:Nightmare

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=483描述Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get o

2017-10-10 11:03:42 190

原创 题目43:24 Point game

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=43描述There is a game which is called 24 Point game. In this game , you will be given some numbers. Your task is to find an expression which have al

2017-10-09 13:53:42 238

原创 题目523:亡命逃窜

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=523描述从前有个叫hck的骑士,为了救我们美丽的公主,潜入魔王的老巢,够英雄吧。不过英雄不是这么好当的。这个可怜的娃被魔王抓住了,倍受折磨,生死一线。有一天魔王出去约会了,这可是一个千载难逢的逃命机会。你现在的任务就是判断一下这个英雄未遂的孩子能不能在魔王回来之前逃出魔王的城堡,成功逃生,最

2017-10-09 11:30:21 237

原创 题目284:坦克大战

题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=284描述Many of us had played the game “Battle city” in our childhood, and some people (like me) even often play it on computer now. What we are dis

2017-10-04 22:48:00 468

本科计算机网络课件

主要包括实验工具软件、课程实验、作业、以及课件。课件有九章。分别:绪论、数据通信基础、OSI体系结构和物理层、数据链路层、局域网技术、网络层、传输层、高层运用、网络安全和网络管理。

2018-05-27

空空如也

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

TA关注的人

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