#!/usr/bin/env python
#coding:utf8
import time
global_list = []
def test(n):
global global_list
if n==1 or n==2:
return 1
else:
temp = test(n-1) + test(n-2)
if i...
分类:
编程语言 时间:
2015-04-15 09:48:22
阅读次数:
153
首先我们要知道的一点是:在Linux内核中,不同CPU里面,各自的字节序定义都不同。
本次用于分析的 Linux 内核版本为: linux--3.0.0-12。
arch/XXX/include/asm/byteorder.h:不同CPU(XXX)的字节序定义
1)ARM(XXX=arm):
#ifdef __ARMEB__
#include
#else
...
分类:
系统相关 时间:
2015-04-15 09:39:49
阅读次数:
188
import osimport timefilename = "test.txt"info = os.stat(filename)if time.time()-info.st_mtime > 600:#10分钟 print "done"else: print "modify"
分类:
编程语言 时间:
2015-04-14 17:59:57
阅读次数:
203
#include
int digitsum(int x)
{
int i;
if(x == 0)
return 0; //递归结束条件
else
{
i = x % 10;
x = x / 10;
}
return i+digitsum(x); //进行递归
}
int main()
{
int sum = 0;
sum = digitsum(1234);
...
分类:
其他好文 时间:
2015-04-14 16:44:17
阅读次数:
142
#include
union
{
long Long;
char Char[sizeof(long)];
} u;
int main(void)
{
u.Long = 1;
if (u.Char[0] == 1) {
printf("Addressing is right-to-left\n");
}
else if (u.Ch...
分类:
其他好文 时间:
2015-04-14 10:01:37
阅读次数:
139
#include
#include
#include
using namespace std;
int n,m;
struct e
{
char a[200];
int id;
int px;
}s[200];
int cmp(e s1,e s2)
{
if(s1.px==s2.px) return s1.id<s2.id;
else return s1....
分类:
其他好文 时间:
2015-04-14 08:35:35
阅读次数:
171
1.条件判断语句scala中的if语句的使用方法跟Java中基本一样。不过在Scala中if-else语句是有返回值的,该值就是if或者else最后一行表达式返回的值。来看个例子:根据REPL中打印的结果,我们可以看到result是Int类型的。result变量的具体值取决于x。习惯于Java编程的...
分类:
其他好文 时间:
2015-04-14 00:27:36
阅读次数:
179
class Program { public int yang(int cun)//求的羊的数量 已知的是村的个数 { int sum = 0; for (int i = 7; i>=cun ; i--) { if (i==7) { sum = 2; } else { sum = (2 * (su....
分类:
其他好文 时间:
2015-04-14 00:13:15
阅读次数:
127
1.概述 因为某个对象消耗太多资源,而且你的代码并不是每个逻辑路径都需要此对象, 你曾有过延迟创建对象的想法吗 ( if和else就是不同的两条逻辑路径) ? 你有想过限制访问某个对象,也就是说,提供一组方法给普通用户,特别方法给管理员用户?以上两种需求都非常类似,并且都需要解决一个更大的问题:.....
分类:
其他好文 时间:
2015-04-14 00:13:05
阅读次数:
209
sum是对内容的数量进行相加,count 对表行数 对象进行统计在使用 case 时,如select subject,count(case when score>80 then score else null end) 优,count(case when score59 then score...
分类:
数据库 时间:
2015-04-13 22:40:29
阅读次数:
176