摘要: #include <stdio.h>#include <math.h>#include <assert.h>int is_prime(int x){int i, m;assert(x >= 0);if (x == 1){return 0;}m = floor(sqrt(x) + 0.5);for (i = 2; i <= m; i++){if (x % i == 0){return 0;}}return 1;}int main(void){int i, m;scanf("%d", &m);for (i = m - 2; 阅读全文
posted @ 2011-09-07 21:25 xxx1 阅读(130) 评论(0) 推荐(0) 编辑
摘要: template <class type> class link{private:static link<type>* freelist;public:type element;link* next;link* prev;link(const type& a, link* pre = NULL, link* ne = NULL){element = a;next = ne;prev = pre;}link(link* pre = NULL, link* ne = NULL){next = ne;prev = pre;}void* operator new(siz 阅读全文
posted @ 2011-09-07 20:59 xxx1 阅读(103) 评论(0) 推荐(0) 编辑