1 #-*-coding:utf-8-*- 2 def bubble(array): 3 flag = True; 4 for i in range(len(array)-1,0,-1):#从后往前比较 5 #print 'i = ',i 6 if...
分类:
编程语言 时间:
2014-10-04 17:50:26
阅读次数:
443
以一个小例子为例:代码 :for i in range(1,10): print 'i = ',i结果:i = 1i = 2i = 3i = 4i = 5i = 6i = 7i = 8i = 9换行处理for i in range(1,10): print 'i = '...
分类:
编程语言 时间:
2014-10-04 17:16:16
阅读次数:
160
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=23846题目大意:给定一个升序序列,有q次询问,每次询问(L,R)出现最多的值的次数。解题思路:非常麻烦的题目。尽管一眼就能看出来是个RMQ。关键在于如何转化为RMQ。...
分类:
其他好文 时间:
2014-10-03 20:45:05
阅读次数:
194
1. Type conversion:If we assign an out-of-range value to an object of unsigned type, the result is the remainder of the value modulo the number of val...
分类:
编程语言 时间:
2014-10-03 18:53:04
阅读次数:
198
Problem Description
In this problem, you are given a string s and q queries.
For each query, you should answer that when all distinct substrings of string s were sorted lexicographically, which ...
分类:
其他好文 时间:
2014-10-03 16:56:54
阅读次数:
249
>>> a=range(0,100)>>> b=[a[4],a[6]]>>> a[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,...
分类:
编程语言 时间:
2014-10-02 00:28:41
阅读次数:
330
本文介绍的STL算法中的find、search查找算法。在STL源码中有关算法的函数大部分在本文介绍,包含findand find_if、adjacent_find、search、search_n、lower_bound、 upper_bound、 equal_range、binary_search、find_first_of、find_end相关算法,下面对这些算法的源码进行了详细的剖析,并且适当给出应用例子,增加我们对其理解,方便我们使用这些算法。...
分类:
其他好文 时间:
2014-09-30 21:19:50
阅读次数:
280
题目: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.题目分析: 看了半天,题目都没看懂,都不知道了roman numeral...
分类:
其他好文 时间:
2014-09-30 20:30:50
阅读次数:
251
常用的验证特性标签: StringLength , Required , RegularExpression , Range , MembershipPasswordAttribute(密码强度限制)也可以通过简单扩展, 增加自己的验证特性 /// /// 这东西也就是练手玩一下, 实...
分类:
其他好文 时间:
2014-09-30 18:33:09
阅读次数:
206
RMQ with Shifts
时间限制:1000 ms | 内存限制:65535 KB
难度:3
描述
In the traditional RMQ (Range Minimum Query) problem, we have a static array A. Then for each query (L, R) (L
In this pro...
分类:
其他好文 时间:
2014-09-30 00:51:11
阅读次数:
451