码迷,mamicode.com
首页 >  
搜索关键字:numbers range    ( 16974个结果
Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:其他好文   时间:2014-05-16 23:18:16    阅读次数:360
Leetcode 二分查找 Search Insert Position
题意:输出一个元素在一个已排序的数组中的位置,如果不存在输出它应该插入的位置 思路:二分查找,如果找到就输出位置,找不到就输出它应该插入的位置 复杂度:时间O(log n),空间O(1) 相关题目: Search for a Range Search a 2D Matrix...
分类:其他好文   时间:2014-05-15 05:57:32    阅读次数:271
LeetCode-004 Add Two Numbers
【题目】 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Out...
分类:其他好文   时间:2014-05-15 05:13:49    阅读次数:306
hdu how many prime numbers 筛选法求素数
/* * hdu How many prime numbers * date 2014/5/13 * state AC */ #include #include #include using namespace std; bool isPrime(int x) { int sqr=sqrt(x*1.0); for(int i=2;i<=sqr;i++) {...
分类:其他好文   时间:2014-05-15 05:07:18    阅读次数:261
LA 4727
Integers1, 2, 3,...,nare placed on a circle in the increasing order as in the following figure. We want to construct a sequence from these numbers on ...
分类:其他好文   时间:2014-05-14 02:54:10    阅读次数:354
poj 1715 Hexadecimal Numbers 排列组合
1 /** 2 大意: 给定16进制数的16个字母,,求第k大的数,,要求数的长度最大为8.,并且每个数互不相同。 3 思路: 从高到低挨个枚举,每一位能组成的排列数 ,拿最高位来说,能做成的排列数为15*A(15,len-i) 4 第二位 A(14,len-2)。。这样就可以...
分类:其他好文   时间:2014-05-13 21:58:38    阅读次数:402
day6_python学习笔记_chapter8_条件,循环
1. if elif else 2. 条件表达式:三元操作符: smaller = x if x < y else y == if x < y : smaller =x else : smaller = y3. range(start, end, step=1) 4. xrange(): 当有一个很...
分类:编程语言   时间:2014-05-13 21:48:28    阅读次数:362
【LeetCode】Triangle
TriangleGiven 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...
分类:其他好文   时间:2014-05-13 18:51:44    阅读次数:297
Python重写C语言程序100例--Part4
''' 【程序24】 题目:有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和。 1.程序分析:请抓住分子与分母的变化规律。 2.程序源代码: ''' #方法一 a = 2.0 b = 1.0 s = 0 for n in range(1,21): s += a / b t = a a = a + b b = t ...
分类:编程语言   时间:2014-05-13 15:54:13    阅读次数:371
[ACM] 1016 Prime Ring Problem (深度优先搜索)
Prime Ring Problem Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent...
分类:其他好文   时间:2014-05-13 11:54:17    阅读次数:444
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!