题目描述Give you a string S,assume the Sub-String Stri
= S[0..i] and the length of the string is N. e.g. S = "moreandmorecold", N = 15,
Str0 = "m" Str1 = ...
分类:
其他好文 时间:
2014-05-14 02:36:45
阅读次数:
314
群聊的前台主要代码:
{%block content%}
测试版本,每天凌晨4:00清水,enjoy it~~:-)-->
{%for i in content[19*int(num)-19:19*int(num)]%}
【{{i[1]}}】 ({{i[3]}}) : {{i[2]}}
{%end%}
{%for i in range(1,pages+1)%}
{{i}}
{%...
分类:
其他好文 时间:
2014-05-13 23:14:45
阅读次数:
388
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
前面我们写了常见的几种排序算法,并分析了各种算法的实现思想,及时间复杂度等情况,但由于只是分析,木有实际的数据做对比测试,所以对各个算法的效率也没有一个明确的概念,下面我们就通过具体的测试来看看同算法之间的效率差距。声明11个长度为100的元素取值范围为0到1000的序列int
length = 1...
分类:
其他好文 时间:
2014-05-13 21:46:24
阅读次数:
323
Cut the Sequence
Time Limit: 2000MS
Memory Limit: 131072K
Total Submissions: 8764
Accepted: 2576
Description
Given an integer sequence { an } of length N, you are to ...
分类:
其他好文 时间:
2014-05-13 16:04:29
阅读次数:
267
'''
【程序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
不是很明白出题人的意图,其实这道题用java的话简直是太简单了,用split处理一下,得到所有单词的一个数组,然后求最后一个的长度就行了。我个人觉得java里最成功的函数就是split了,我做工程时几乎总能用到它,方便强大。
c++里面稍微复杂一些,不过这也算是最简单的字符串的问题了。函数的接口决定了字符串的长度是未知的,要自己循环找一下,然后从尾向头找不等于空格的字符,找到了就找到了最后一个单...
分类:
其他好文 时间:
2014-05-13 15:40:48
阅读次数:
222
中心节点就是树的中心,2遍dfs求到树的直径,而中心一定在直径上,顺着直径找到中心就够了。
然后可以一遍树形DP找到最小值或者二分+判断是否访问到叶子节点。
#include
#include
#include
#include
using namespace std;
struct node
{
int next;
int power;
int length...
分类:
其他好文 时间:
2014-05-13 11:28:38
阅读次数:
306
HITAG S--3rd generation HITAG? familyModulation
Read/Write Device to Transponder: 100 % ASK and Binary Pulse Length
CodingModulation Transponder to Re...
分类:
其他好文 时间:
2014-05-13 11:09:10
阅读次数:
336
#!/usr/bin/envpython#coding:utf8#随机生成自定义长度密码fromrandomimportchoiceimportstring,pickledefGenPassword(length=8,chars=string.ascii_letters+string.digits):return‘‘.join([choice(chars)foriinrange(length)])defpasslist(r_user,c_user,ip_list,web_list):di..
分类:
编程语言 时间:
2014-05-13 01:25:56
阅读次数:
505