上一页 1 ··· 7 8 9 10 11 12 下一页
摘要: C语言带参数的main函数 #include<stdio.h> int main(int argc,char*argv[]) { int i; for(i=0;i<argc;i++) printf("%s\n",argv[i]); getchar(); getchar(); return 0; } 阅读全文
posted @ 2016-02-24 10:51 hopskin1 阅读(386) 评论(0) 推荐(0) 编辑
摘要: public class Fibonacci{ public static long F(long n){ System.out.println("call F" + n); if (n == 0) return 0; if (n == 1) return 1; long t = F(n-1) + 阅读全文
posted @ 2016-02-22 16:48 hopskin1 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 格雷码 the n-1 bit code, with 0 prepended to each word, followd by the n-1 bit code in reverse order, with 1 prepended to each word. public class GrayCod 阅读全文
posted @ 2016-02-22 16:03 hopskin1 阅读(257) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> void towers(int,char,char,char); int main() { int num; printf("Enter the number of disks : "); scanf("%d", &num); printf("The sequen 阅读全文
posted @ 2016-02-22 09:14 hopskin1 阅读(377) 评论(0) 推荐(0) 编辑
摘要: 求两个数 p 和 q 的最大公约数(greatest common divisor,gcd),利用性质 如果 p > q, p 和 q 的最大公约数 = q 和 (p % q)的最大公约数。 证明:见 http://blog.csdn.net/niushuai666/article/details/ 阅读全文
posted @ 2016-02-21 22:29 hopskin1 阅读(502) 评论(0) 推荐(0) 编辑
摘要: http://paste.ubuntu.com 阅读全文
posted @ 2016-02-21 19:27 hopskin1 阅读(776) 评论(0) 推荐(0) 编辑
摘要: 输出第N个素数 public class FindNthPrime { public static void main(String[] args){ int N = Integer.parseInt(args[0]); //要求输出第 N 个素数 int[] PrimesVector = new 阅读全文
posted @ 2016-02-20 21:49 hopskin1 阅读(1227) 评论(0) 推荐(1) 编辑
摘要: 输出不大于N的素数的个数 Sieve of Eratosthenes 方法 素数的性质: 非素数可以分解为素数乘积。 证明 (1)n = 2 成立,n = 3 成立; (2)若 n = k 时成立,n = k+1时,假设 n = k+1 = k1*k2, 如果 k+1 是素数,k1 = 1, k2 阅读全文
posted @ 2016-02-20 19:50 hopskin1 阅读(1550) 评论(0) 推荐(0) 编辑
摘要: 今天是20号呀,大喜过望,新的一学期,开工了。 腾讯面试题:50个阶梯,你一次可以上一阶或两阶,走上去,共有多少种走法。 f(n)=f(n-1)+f(n-2) f(n)定义:上n个阶梯,有f(n)种走法 要到 第 n 个阶梯,要么经过第 n-1 个阶梯,要么不经过 斐波那契数,大数溢出问题没考虑。 阅读全文
posted @ 2016-02-20 10:45 hopskin1 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 素数 A prime is an integer greater than one whose only positive divisors are one and itself.整数的素因子分解是乘积等于此素数的集合。例如:3757208 = 2*2*2*7*13*13*397 public cl 阅读全文
posted @ 2016-02-19 22:36 hopskin1 阅读(148) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 下一页