#include
using namespace std;
int partition(int *a,int p,int r)
{
int x=a[r];
int i=p-1;//note i important which is used for
//storage the number smaller than flag x=a[r]
for (int j=p;j<r;j++...
分类:
其他好文 时间:
2014-07-08 21:06:59
阅读次数:
232
int_ip = lambda x: '.'.join([str(x/(256**i)%256) for i in range(3,-1,-1)])ip_int = lambda x:sum([256**j*int(i) for j,i in enumerate(x.split('.')[::-1]...
分类:
编程语言 时间:
2014-07-06 21:21:30
阅读次数:
281
unity为开发者提供了很多方便开发的工具,他们都是由系统封装的一些功能和方法。比如说:实现时间的time类,获取随机数的Random.Range( )方法等等。
时间类
time类,主要用来获取当前的系统时间。
using UnityEngine;
using System.Collections;
public class Script_04_13 : MonoBehaviou...
分类:
其他好文 时间:
2014-07-06 11:46:34
阅读次数:
325
1、Swift 无需写break,所以不会发生这种贯穿(fallthrough)的情况。
2、//用不到变量名,可用“_”替换
for _ in 1...power
{
answer *= base
}
3、case 可以匹配更多的类型模式,包括区间匹配(range matching),元组(tuple)和特定类型的描述。
可以这样用case
case 1...3:
natura...
分类:
其他好文 时间:
2014-07-06 00:52:44
阅读次数:
194
def IsContinuous(seq, num = 5):
zeros = 0; d = 0
seq = sorted(seq)
for i in range(num - 1):
if seq[i] == 0:
zeros += 1
continue
if seq[i] == seq[i + 1]:
return False
d += seq[i + 1]...
分类:
其他好文 时间:
2014-07-04 07:11:20
阅读次数:
171
1、sum over用法
sum(col1) over(partition by col2 order by col3 )
以上的函数可以理解为:按col2 进行分组(partition ),每组以col3 进行排序(order),并进行连续加总(sum)
表a,内容如下:
B C D
02 02 1
02 03 2
02 04 3
02 05...
分类:
其他好文 时间:
2014-07-04 07:09:15
阅读次数:
503
#encoding=utf-8
#这是一个易经的启卦程序,在windows下的python3.3下创建‘
#启卦要本着易的四原则,无事不占,不动不占,无疑不占.不能乱占。
importrandom
banyao=range(1,385)
#获取1到384的随机数。
fz=[]
#爻的阴阳列表
fx=[]
#爻符列表
fy=["初","二","三","四","五","..
分类:
编程语言 时间:
2014-07-04 06:42:35
阅读次数:
500
步骤/方法
分三个步骤
在头文件中声明函数例如
afx_msg void onNum(UINT uID)
在.cpp文件中添加函数体
void CCalculatorDlg::OnNum(UINT uID)
{
UINT index=uID-IDC_NUM_0;
CString num;
num.Format(_T("%d"),index);
A...
分类:
其他好文 时间:
2014-07-04 00:38:58
阅读次数:
307
row_number() OVER (PARTITION BY COL1 ORDER BY COL2)
--表示根据COL1分组,在分组内部根据 COL2排序,而此函数返回的值就表示每组内部排序后的顺序编号(组内连续的唯一的)
例子一: create table student (id int ,classes int ,score int);
insert into student val...
分类:
其他好文 时间:
2014-07-03 18:33:50
阅读次数:
213
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.int key[]={1000, 900, 500, 400, 100,90, 50, ...
分类:
其他好文 时间:
2014-07-03 12:06:47
阅读次数:
186