- 博客(4)
- 资源 (1)
- 收藏
- 关注
原创 hdu2222——Keywords Search//AC 自动机
注意点:cnt 应设为0,可能一个字母对应有几个单词,所以,每次遇到时,要cnt++。计算的时候,也需count+=cnt; #include #include #include using namespace std; class node { public: int cnt; node * next[26]; node * fail; node() { fail =NULL;
2012-01-15 21:53:31 367
原创 ZOJ3418--Binary Number//二进制
利用异或、与的操作。 #include #include using namespace std; int p[32]; int find(int x) { int k=0; for(int i=0;i<31;i++) { if(x&p[i]) k++; } return k; } int main() { p[0]=1; for(int i=1;i<31;i++) p[i]=
2012-01-07 15:34:17 450
原创 ZOJ3498--Javabeans//规律
找出规律:1 2 2 3 3 3 3 4 4 4 4 4 4 4 4 .... #include #include using namespace std; int main() { int a[31]; long long k=1; for(int i=0;i<31;i++) { a[i]=k; k*=2; } int t; cin>>t; while(t--) {
2012-01-07 14:56:53 885
原创 zoj3499--Median//qsort
求中位数。 #include #include #include using namespace std; int t; int cmp(const void *a,const void *b) { return *(const double*)a>*(const double *)b?1:-1; } int main() { cin>>t; int n; double a[600]
2012-01-07 14:18:11 618
创建学生信息管理系统
2010-12-06
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人