码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
一个HexToInt的C/C++函数
int BetterVenca25(char* hex){ int res=0; for(;*hex;hex++) { int d=toupper(*hex); if(d >='0' && d ='A' && d <='F')d-='A'-10; else return -1; res=res*16...
分类:编程语言   时间:2014-10-09 14:40:43    阅读次数:231
js去除前后空格
js去除前后空格
分类:Web程序   时间:2014-10-09 14:13:43    阅读次数:202
PHP通用代码
一个是curl的post请求函数,主要用于各平台api开发,进行请求接口的处理函数,如果你有多个平台,互相之间要传递数据,用这个函数绝对好用: PHP Code复制内容到剪贴板 /**   * curl访问程序接口   * @param string   * @return array   */   function getCurlDate($url, $data...
分类:Web程序   时间:2014-10-09 03:18:48    阅读次数:302
C#根据出生日期计算年龄
publicintCalculateAge(DateTimebirthDate,DateTimenow){intage=now.Year-birthDate.Year;if(now.Month<birthDate.Month||(now.Month==birthDate.Month&&now.Day<birthDate.Day)){age--;}returnage;}
分类:其他好文   时间:2014-10-09 03:16:38    阅读次数:185
LeetCode Remove Duplicates from Sorted Array II
title  描述  Follow up for ”Remove Duplicates”: What if duplicates are allowed at most twice? For example, Given sorted array A = [1,1,1,2,2,3],  Your function should return length = 5, and A is no...
分类:其他好文   时间:2014-10-09 03:14:48    阅读次数:163
LeetCode Remove Duplicates from Sorted Array
问题描述: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place ...
分类:其他好文   时间:2014-10-09 02:58:47    阅读次数:175
常见函数strlen、strcmp、strstr原型实现
数组元素的结束符为'\0',串的结束符为NULL 一、strlen #include using namespace std; long h_strlen(constchar*str){ assert(str!=NULL); const char *s = str; while (*s++); return (s - str - 1); }...
分类:其他好文   时间:2014-10-09 02:55:07    阅读次数:190
Sort List[leetcode] 由归并排序的递归和循环,到本题的两种解法
归并排序可以有两种思路----top-down 和 bottom-up top-down: 递归实现,将数组分成两半,分别处理;再合并。 伪代码如下: split ( A[], l, r) { if ( r - l < 2) return; m = (r + l) / 2; split ( A, l, m); //split A[l…m-1] split ( A, m, r); /...
分类:其他好文   时间:2014-10-09 02:51:37    阅读次数:222
hdu 2899 hdu 3400 三分/几何
hdu2899 ; 水提,直接三分,其实求导后二分也可以。 #include #include using namespace std; double y; double inline f( long double x) { return 6*x*x*x*x*x*x*x+8*x*x*x*x*x*x+7*x*x*x+5*x*x-y*x; } int main() { in...
分类:其他好文   时间:2014-10-09 01:59:18    阅读次数:217
Clone Graph [leetcode] dfs和bfs
变量unordered_map cloneMap; DFS: UndirectedGraphNode *cloneGraph(UndirectedGraphNode *node) { if (node == NULL) return NULL; if (cloneMap.find(node) != cloneMap.end())...
分类:其他好文   时间:2014-10-09 01:23:57    阅读次数:158
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!