2^k:int lowbit(int t){ return t&(-t);}简单的数据结构,占用的时间少,是在O(logn)时间里插入,求和。(1)hdu 1541 Stars基本的题,因为加入点的顺序,每次就是求区间(0,x)的和。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #define size 32005 5 const int max=32005; 6 int num[size]; 7 int level[size]; 8 int low Read More
posted @ 2012-10-07 16:18
feng_linxu
Views(115)
Comments(0)
Diggs(0)
(1)hdu 1075 What Are You Talking About 【stl or 字典树】 动态建立字典树View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 5 typedef struct node 6 { 7 node *child[26]; 8 char str[12]; 9 char flag; 10 }node, *Node; 11 12 Node root; 13 14 void build_trie(Node *root) ... Read More
posted @ 2012-10-07 13:25
feng_linxu
Views(165)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号