摘要: 1 /* 2 本程序说明: 3 4 [编程题] 求素数 5 时间限制:2秒 6 空间限制:32768K 7 输入M、N,1 =2 23 #include 24 #include 25 #include 26 using namespace std; 27 ///寻找N以内的质数的个数 28 size_t find_Prime(int N) 29 { 30 if(1=... 阅读全文
posted @ 2017-08-18 16:37 xiaoxi666 阅读(1951) 评论(0) 推荐(0) 编辑
摘要: 1 //fibonacci,find the nth num. 1 1 2 3 5 8... 2 #include 3 using namespace std; 4 5 int fib(int n){ 6 if(n==1 || n==2){ 7 return 1; 8 } 9 int prev=1; 10 int result=1; 11 n-=... 阅读全文
posted @ 2017-08-18 16:34 xiaoxi666 阅读(283) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <vector> 3 using namespace std; 4 5 int nth_prime(int n) { 6 vector<int> primes(n); 7 primes[0] = 2; 8 int CntOfPrime 阅读全文
posted @ 2017-08-18 16:32 xiaoxi666 阅读(243) 评论(0) 推荐(0) 编辑
TOP