令Pi表示第i个素数。现任给两个正整数M int sushu(int n){//素数判断 int k; if(n==2) return 1; if(n%2==0) return 0; for(k=3;k*k=a && count <=b){//输出处理环节 add++; ...
分类:
其他好文 时间:
2014-07-22 08:01:36
阅读次数:
139
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
分类:
编程语言 时间:
2014-07-22 00:39:35
阅读次数:
263
Recursive.class Solution { public: bool isSymmetric(TreeNode *pl, TreeNode *pr) { if (!pl && !pr) return true; if ((pl && !pr)...
分类:
其他好文 时间:
2014-07-22 00:36:36
阅读次数:
197
函数:具有特定功能的代码段,分为库函数,自定义函数.函数定义:函数返回值类型 函数名(形式参数列表){代码段;return 返回值;}注意:每个函数返回值最多只有一个.return是一个函数结束的标志.形式参数(形参):函数定义时使用的虚拟参数名,用以接收函数调用是传递过来的实际值.实际参数(实参)...
分类:
其他好文 时间:
2014-07-22 00:33:35
阅读次数:
260
Reference: http://blog.csdn.net/lbyxiafei/article/details/9375735题目:Implement int sqrt(int x).Compute and return the square root of x.题解: 这道题很巧妙的运用了二....
分类:
编程语言 时间:
2014-07-21 11:22:09
阅读次数:
293
根据自己的需要,挑选适合的代码放在主题的functions.php文件中就可以了/* 去除 WordPress 後台升級提示 */// 2.8 ~ 2.9:add_filter('pre_transient_update_core', create_function('$a', "return...
分类:
其他好文 时间:
2014-07-21 11:12:27
阅读次数:
259
Another recursion problem.class Solution {public: int getHeight(TreeNode *p) { if (!p) return 0; int hL = 1; if (p->left) h...
分类:
其他好文 时间:
2014-07-21 11:10:03
阅读次数:
180
Simply care about the boundary cases:class Solution {public: ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { if (l1 && !l2) return l1;...
分类:
其他好文 时间:
2014-07-21 11:07:04
阅读次数:
206
强烈推荐在线学习网站:http://tryruby.org/笔记:Ruby会默认返回方法中的最后一个值。 如果需要返回多个值,可以用数组来实现。 可以通过强制声明return来返回值。 基础的输出方法是用puts(输出一行),print(直接打印)。 基础的输入方法是gets(读入一行,包含行尾的'...
分类:
其他好文 时间:
2014-07-21 11:06:41
阅读次数:
238
继承class Vehicle { var numberOfWheels: Int var maxPassengers: Int func description() -> String { return "\(numberOfWheels) wheels; up t...
分类:
其他好文 时间:
2014-07-21 11:01:56
阅读次数:
225