原题地址:http://oj.leetcode.com/problems/two-sum/题意:找出数组numbers中的两个数,它们的和为给定的一个数target,并返回这两个数的索引,注意这里的索引不是数组下标,而是数组下标加1。比如numbers={2,7,11,17};
target=9。那...
分类:
编程语言 时间:
2014-04-30 21:45:43
阅读次数:
528
This is a two player game. Initially there
areninteger numbers in an array and playersAandBget chance to take them
alternatively. Each player can take...
分类:
其他好文 时间:
2014-04-30 20:34:38
阅读次数:
519
最差的算法:最差的算法:去重,与数组是否有序无关public void noDups(){
//从0开始遍历 for(int i=0; i<nElems-1; i++){ //与后面每一个比较 for(j=i+1; j<nElems;
j++){ ...
分类:
其他好文 时间:
2014-04-29 12:13:47
阅读次数:
427
1.添加元素的时候,先取出数组,再向数组中添加元素:-
(void)addPeason:(AddressPeason*)peason{
if(![[peasongetName]isEqualToString:nil]) {
for(NSString*stringin[_peasonDiction.....
分类:
其他好文 时间:
2014-04-29 11:22:45
阅读次数:
535
LeyniTime Limit: 3000 MS Memory Limit: 65536 KTotal
Submit: 260(59 users) Total Accepted: 80(55 users) Rating: Special Judge:
NoDescriptionLeyni被人...
分类:
其他好文 时间:
2014-04-29 11:15:46
阅读次数:
438
组合数学、-排列组合数----sum求sum=sum*(m--)/i;----二维数组递推(打表)---原始公式(单个)数字太大,用分子分母约分-全排列模板-----生成全排列函数prev_permutation和next_permutation区别http://www.cnblogs.com/zh...
分类:
其他好文 时间:
2014-04-29 10:31:46
阅读次数:
408
第一次打表一言难尽 注意表的范围 因为打表 数组长度不好计算算
要有个结尾标志#includeusing namespace std;int
prime[1000]={5,7,11,101,131,151,181,191,313,353,373,383,727,757,787,797,919,9.....
分类:
其他好文 时间:
2014-04-29 10:27:47
阅读次数:
471
这道题比较简单,就是用数组存取其路径。如101和102是对门,其过道号可以记为51.
1和2之间的为1. 今早突然收到操作系统停课的通知,哈哈 回来就做一下水题,开心 1 #include 2 #include 3 int main() 4 {
5 //freopen("input.txt"...
分类:
其他好文 时间:
2014-04-29 09:15:47
阅读次数:
370
qsort(&g_AMTBuf[g_dwAMTLenth], m_nCount,
sizeof(12), Compare);参数说明:1.待排序数组首地址;2.数组中待排序元素数量;3.各元素的占用空间大小;4.指向函数的指针。1 int
Compare(const void *a,const vo...
分类:
其他好文 时间:
2014-04-29 09:12:46
阅读次数:
398