本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Reverse Integer
Total Accepted: 17472 Total
Submissions: 43938
Reverse digits of an integer.
Example1: x = 123, return 32...
分类:
其他好文 时间:
2014-05-14 00:59:13
阅读次数:
369
python中的单元测试可以使用doctest,unittest完成
1.doctest的使用
(1)写入程序如下(cubetest.py):
#!/usr/bin/python
def cube(x):
"""
cube a number and return the result
>>> cube(2)
8
>>> cube(3)
27
>>> cube(4)
64...
分类:
编程语言 时间:
2014-05-13 23:33:19
阅读次数:
491
Pat1018代码
题目描述:
There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and return it to an...
分类:
其他好文 时间:
2014-05-13 23:27:04
阅读次数:
582
效果图:
程序分析:
初始化GameLayer场景触摸,背景、音乐、UI及定时间器
bool GameLayer::init()
{
if (!CCLayer::init()) {
return false;
}
// 开启触摸
this->setTouchEnabled(true);
// 创建数组,需要...
分类:
其他好文 时间:
2014-05-13 07:39:29
阅读次数:
214
Assembly instructions
汇编初步学习
汇编0基础的戳上面,刷一遍,包治百病
%eax寄存器的值与C语言的return的值相对应
(%esp)地址处储存的是函数的返回地址 return address
%esp 栈顶寄存器 保存栈顶指针。
%ebp = boundary between p...
分类:
其他好文 时间:
2014-05-13 06:28:37
阅读次数:
416
1、当你想并发去执行一段代码,但是还想获取这段代码的返回结果,那么future多线程模式就可以派上用场了,代码实现如下。publicclassClient{
publicDatarequest(){
finalFutureDatafutureData=newFutureData();
newThread(newRunnable(){
@Override
publicvoidrun(){
futureDat..
分类:
编程语言 时间:
2014-05-13 01:29:02
阅读次数:
405
7.1 操作系统接口
Os模块提供主要许多与操作系统交互的函数。
>>> import os
>>> os.getcwd() # Return the current working directory
’C:\\Python31’
>>> os.chdir(’/server/accesslogs’) # Change current working directory
>>> ...
分类:
编程语言 时间:
2014-05-12 23:08:03
阅读次数:
356
Spiral MatrixGiven a matrix ofmxnelements
(mrows,ncolumns), return all elements of the matrix in spiral order.For
example,Given the following matrix:[...
分类:
其他好文 时间:
2014-05-12 20:04:43
阅读次数:
268
Given an integern, generate a square matrix
filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should
return the following matri...
分类:
其他好文 时间:
2014-05-12 19:53:23
阅读次数:
332
如何防止回车(enter)键提交表单,其实很简单,就一句话。onkeydown="if(event.keyCode==13)return
false;"把这句写在from标签里面就好了。如果在页面中按Enter键会自动提交的话,可以设置返回值防止自动提交如返回值必须是false function
g...
分类:
Web程序 时间:
2014-05-12 19:51:18
阅读次数:
511