1、函数是一种 “第一类值”
a = {p = print};
a.p("hello");
a = print;
a("Hi");
2、 table 提供的函数 table.sort
network = {
{name = "lua", IP = "192.168.1.1"},
{name = "CPP", IP = "192.168.1.2"}
};
f...
分类:
其他好文 时间:
2014-05-10 09:21:02
阅读次数:
273
题意:
给你ABCD四个集合,集合中数的个数都为N(N
当然你可以尝试枚举所有的组合,绝对可以计算出结果,大概有N^4种吧,如果你有足够的时间还是可以算出来的,哈哈。
当然我不是用上面一种方法计算的,那样算肯定超时。 我的做法是求出所有a+b 到ab数组中, 和所有 c+d到cd数组中,然后排序,枚举每个ab,用二分在cd中查找有没有可能组成0。 有个问题就...
分类:
其他好文 时间:
2014-05-10 08:40:14
阅读次数:
278
其实,利用ASP.NET输出指定内容的WORD、EXCEL、TXT、HTM等类型的文档很容易的。主要分为三步来完成。 一、定义文档类型、字符编码
Response.Clear(); Response.Buffer= true; Response.Charset="utf-8"; ...
分类:
Web程序 时间:
2014-05-09 18:24:58
阅读次数:
352
最近在做一个项目,就是设计一套通信协议,利用nginx来实现解析。协议内容是包括整数和字符串,现在客户端收到服务器端发送的网络字节流时,需要从中提取出整数,再根据整数决定发送数据量的大小。如下所示:
p = u->buffer.pos;num=*(int*)pp指向接收到的网络字节流,用这么方式解析...
分类:
其他好文 时间:
2014-05-08 20:26:37
阅读次数:
308
环境:vs2012 win7 c++1 #include2
写一个比较函数,体现对象间是按照哪些key值来排序的。3 使用std::sort函数。例子如下:#include
/*排序规律:星级最大的排前面,其次等级越大排前面,再其次是经验越大排前面,最后是其次是ID值越大排越后面。*/bool my...
分类:
其他好文 时间:
2014-05-08 19:54:37
阅读次数:
226
java实现排序的一些方法,来自:http://www.javaeye.com/topic/548520 1
package sort; 2 3 import java.util.Random; 4 5 /** 6 * 排序测试类 7 * 8 *...
分类:
编程语言 时间:
2014-05-07 19:13:32
阅读次数:
448
Given an array with n objects colored red,
white or blue, sort them so that objects of the same color are adjacent, with
the colors in the order red, ...
分类:
其他好文 时间:
2014-05-07 18:01:05
阅读次数:
412
【题目】
原文:
1.3 Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine. An
extra copy of...
分类:
其他好文 时间:
2014-05-07 08:48:12
阅读次数:
372
private static void sort1(int x[], int off, int len) {
// Insertion sort on smallest arrays //长度小于7,采用冒泡排序
if (len < 7) {
for (int i=off; ioff && x[j-1]>x[j];...
分类:
其他好文 时间:
2014-05-07 05:14:35
阅读次数:
279
简介DeviceIoControl的三种通信方式...