码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
质因数的求法
质因数分解 /* 求质因数 */ #include #include int main() { int n,a=2; printf("please input n:"); scanf("%d",&n); if(n<=1) { printf("input error!\n"); return -1; } while(a*a < n) { while(n%a==0) ...
分类:其他好文   时间:2014-05-26 05:50:40    阅读次数:279
cocos2dx 获取当前时间
之前使用过cocos2d-x获取系统时间,毫秒级的 [cpp] view plaincopy long getCurrentTime()      {           struct timeval tv;           gettimeofday(&tv,NULL);           return tv.tv_sec * 10...
分类:其他好文   时间:2014-05-26 05:37:49    阅读次数:358
js 面向对象
function Animal(name) { this.name = name; } Animal.prototype.eat = function(food) { console.log("food"); }; Animal.prototype.getName = function() { return this.name; }; var a = new An...
分类:Web程序   时间:2014-05-26 05:21:44    阅读次数:345
求两个字符串最长公共子串(动态规划)
code如下: //Longest common sequence, dynamic programming method void FindLCS(char *str1, char *str2) { if(str1 == NULL || str2 == NULL) return; int length1 = strlen(str1)+1; int length2 = strlen(...
分类:其他好文   时间:2014-05-26 04:56:50    阅读次数:215
LeetCode: N-Queens II [051]
【题目】 Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. 【题意】 解N皇后问题,N-Queens要求返回所有的解,而本题只需要返回可行解的数目 【思路】 DFS,参考N-Queens...
分类:其他好文   时间:2014-05-25 01:51:55    阅读次数:236
LeetCode: Spiral Matrix [058]
【题目】 Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] You should return [1,2,3,6,9,8,7,4,5]. 【题意】 螺旋输出MxN...
分类:其他好文   时间:2014-05-24 23:11:02    阅读次数:279
Android 下载APK 安装APK 打开APK
今天有了一个这样的需求 :下载一个apk文件,然后当你下载完成后,按钮的文字发生改变,变成点击安装,然后安装完成之后,变成打开。 这是下载apk的方法: /** * 后台在下面一个Apk 下载完成后返回下载好的文件 * * @param httpUrl * @return */ private File downFile(final String httpUrl) {...
分类:移动开发   时间:2014-05-24 20:50:50    阅读次数:414
【练习】P62
/*---分别对单链表和双链表,只使用指针来交换两个相邻的元素。---*/ /*-单链表版本-*/ #include #include struct Node{ int val; struct Node *next; }; Node *findEnd(Node *list){ while(list->next) list = list->next; return ...
分类:其他好文   时间:2014-05-24 19:41:49    阅读次数:253
LeetCode: Anagrams [048]
【题目】 Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. For example: Input:  ["tea","and","ate","eat","den"] Output: ["tea","ate","eat"] 【题意】 anagrams指的是颠倒字母顺序构成的单词,以tea为例,则与它an...
分类:其他好文   时间:2014-05-24 18:36:01    阅读次数:317
LeetCode: N-Queens [050]
【题目】 The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. Each solution contains a distinct board configuratio...
分类:其他好文   时间:2014-05-24 17:12:32    阅读次数:237
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!