摘要: http://poj.org/problem?id=2001数据结构,Trie 1 #include <stdio.h> 2 #include <string.h> 3 4 const int CHARSET = 26, BASE = 'a', MAX_NODE = 20100; 5 6 struct trie 7 { 8 int tot, root, child[MAX_NODE][CHARSET]; 9 bool flag[MAX_NODE];10 int cnt[MAX_NODE];11 trie()12 {13 memset(... 阅读全文
posted @ 2013-05-27 20:51 Yuan1991 阅读(113) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=2051数据结构,优先队列 1 #include <stdio.h> 2 #include <string.h> 3 #include <queue> 4 5 using namespace std; 6 7 priority_queue<pair<int, int> > q; 8 9 int main()10 {11 char s[12] = "\0";12 int i, n, id, t[3003];13 pair<int, int> pair1; 阅读全文
posted @ 2013-05-27 19:11 Yuan1991 阅读(137) 评论(0) 推荐(0)
摘要: http://poj.org/problem?id=2992数学,质数,快速求n!中质数p的个数 1 #include <stdio.h> 2 #include <string.h> 3 4 int valid[441] = {0}; 5 int ans[100], tot = 0; 6 7 //O(N)筛质数表 8 void get_prime(int n) 9 {10 int i, j;11 for(i=2; i<=n; i++)12 {13 if(valid[i] == 0)14 {15 tot ++;1... 阅读全文
posted @ 2013-05-27 15:10 Yuan1991 阅读(154) 评论(0) 推荐(0)