#include #include #include #include using
namespace std;int main(){ int n,s; cin >> n >> s; vector a(n);
for(int i = 0 ; i > a[i]; sort...
分类:
其他好文 时间:
2014-04-29 16:42:39
阅读次数:
415
2014-04-28 23:35题目:最大子数组和问题。解法:O(n)解法。代码: 1 //
17.8 Find the consecutive subarray with maximum sum in an array. 2 // O(n)
online algorithm. 3 #include...
分类:
其他好文 时间:
2014-04-29 16:35:28
阅读次数:
429
getByclass传入两个参数,oParent是父集,sClass是要传入class名称 1
function getByClass(oParent,sClass){ 2 var aChild =
oParent.getElementsByTagName("*"), 3 r...
分类:
其他好文 时间:
2014-04-29 16:27:10
阅读次数:
366
一、可变参数函数实现原理C函数调用的栈结构:可变参数函数的实现与函数调用的栈结构密切相关,正常情况下C的函数参数入栈规则为__stdcall,
它是从右到左的,即函数中的最右边的参数最先入栈。本文地址:http://www.cnblogs.com/archimedes/p/variable-para...
分类:
编程语言 时间:
2014-04-29 15:53:26
阅读次数:
704
字符数组是C语言中最常用的数组类型。下面我们通过编写一个程序,来说明字符数组以反操作字符数组的函数的用法。该程序读入一组文本行,并把最长的文水行打印出来。该算法的基本框架非常简单:
while (还有未处理的行) i f (该行比已处理的最长行还要长) 保存该行 保存该行的长度 打印最长的...
分类:
编程语言 时间:
2014-04-29 15:50:20
阅读次数:
506
#include#includeusing namespace std;void
printMonth(int year, int month);void printMonthTitle(int year, int month);void
printMonthName(int month);void...
分类:
其他好文 时间:
2014-04-29 15:36:57
阅读次数:
405
比如对于数组[1,-2,3,5,-1,2] 最大子数组和是sum[3,5,-1,2] = 9,
我们要求函数输出子数组和的最大值,并且返回子数组的左右边界(下面函数的left和right参数).本文我们规定当数组中所有数都小于0时,返回数组中最大的数(也可以规定返回0,只要让以下代码中maxsum初...
分类:
其他好文 时间:
2014-04-29 15:32:49
阅读次数:
554
2014-04-28
23:28题目:给定一个数字,用英语把它读出来。解法:ZOJ上有相反的题目。如果我要用中文读书来呢?代码: 1 // 17.7 Read an integer
in English. 2 #include 3 #include 4 using namespace s...
分类:
其他好文 时间:
2014-04-29 15:29:44
阅读次数:
423
最近看swipe.js源码看到handleEvent这个属性。查了一下资料才知道:使用
addEventListener 可以绑定事件,并传入回调函数。Mozilla 0.9.1 和 Netscape 6.1
之后的版本不但支持传递函数引用,也都允许直接把拥有 handleEvent 方法的对象作为...
分类:
其他好文 时间:
2014-04-29 15:11:22
阅读次数:
416
2014-04-29
00:56题目:不用算数运算,完成加法。解法:那就位运算吧,用加法器的做法就可以了。代码: 1 // 18.1 add two numbers wihout
using arithmetic operator. 2 #include 3 using namespace std....
分类:
其他好文 时间:
2014-04-29 14:58:53
阅读次数:
383