03 2017 档案
摘要:题目描述 一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法 在评论区找到三种有趣的理解: 青蛙只跳1或2可以得出是一个斐波那契问题,即a[n]=a[n-1]+a[n-2],那么能跳1,2,3个台阶时a[n]=a[n-1]+a[n-2]+a[
阅读全文
摘要:这个文章是几年前水acm的时候转的, 当时也不知道作者是谁, 要是有人知道的话说一下吧 并查集是我暑假从高手那里学到的一招,觉得真是太精妙的设计了。以前我无法解决的一类问题竟然可以用如此简单高效的方法搞定。不分享出来真是对不起party了。(party:我靠,关我嘛事啊?我跟你很熟么?) 来看一个实
阅读全文
摘要:转载自:http://blog.csdn.net/hackbuteer1/article/details/7558868 首先:强调一个概念定义一个函数为虚函数,不代表函数为不被实现的函数。 定义他为虚函数是为了允许用基类的指针来调用子类的这个函数。 定义一个函数为纯虚函数,才代表函数没有被实现。
阅读全文
摘要:迭代简介 迭代,是一种数值方法,具体指从一个初始值,一步步地通过迭代过程,逐步逼近真实值的方法。 与之相对的是直接法,也就是通过构建解析解,一步求出问题的方法。 通常情况下,我们总是喜欢一步得到问题的结果,因此直接法总是优先考虑的。 但是,当遇到复杂的问题时,特别在未知量很多,方程非线性时,无法得到
阅读全文
摘要:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Note: There are at
阅读全文
摘要:Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Sil
阅读全文
摘要:Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of
阅读全文
摘要:本文转自:http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html#!comments 1. 正则表达式基础 1.1. 简单介绍 正则表达式并不是Python的一部分。正则表达式是用于处理字符串的强大工具,拥有自己独特的语法以及一个独立的
阅读全文
摘要:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1: Exa
阅读全文

浙公网安备 33010602011771号