2013年3月21日
摘要: hdu 2138 How many prime numbers 1 /* 2 2013-03-21 15:10:20 Accepted 2138 15MS 544K 1338 B 3 筛法就是预先打表处理 4 任何一个非素数必能转换成若干素数之积 5 本题根据以上定理给出10以内的素数,然后打一个素数表, 6 再根据定理求给定的数是否为素数 7 */ 8 #include <iostream> 9 #include <stdio.h>10 #include <string.h>11 #include <math.h>12 using namesp 阅读全文
posted @ 2013-03-21 15:24 行者1992 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 分拆素数和 1 /* 2 写于13年3月21日,练习素数筛法 3 用普通的方法超时啊啊啊啊!!! 4 2013-03-21 11:19:23 Accepted 2098 15MS 268K 5 */ 6 #include <iostream> 7 #include <stdio.h> 8 #include <string.h> 9 using namespace std;10 bool prim[10010];//prim[i]=1表示i为素数11 void is_prim()12 {13 memset(prim,1,sizeof(prim));14 p.. 阅读全文
posted @ 2013-03-21 11:30 行者1992 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Count the string 1 /* 2 写于13年3月21日 3 http://acm.hdu.edu.cn/showproblem.php?pid=3336 4 2013-03-21 10:39:01 Accepted 3336 46MS 2016K 5 很巧妙的利用了KMP函数get_next()的思想 6 通过对其进行改写达到目的 7 data[i]表示[1....i]字符串出现的次数 8 */ 9 10 #include <iostream>11 #include <stdio.h>12 #include <string.h>13 using 阅读全文
posted @ 2013-03-21 10:40 行者1992 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Stars 1 /* 2 写于13年3月21日 3 单点更新,区间求和,二维树状数组 4 输入x1,x2,y1,y2时,输成了x1,y1,x2,y2。调试了两个小时,汗! 5 6 注意:i=0||j=0时,lowbit()返回0 ,add()函数会进入死循环 7 所以数据输入后进行自加操作 8 */ 9 #include <iostream>10 #include <stdio.h>11 #include <string.h>12 using namespace std;13 const int maxn=1010;14 int tree[maxn][max 阅读全文
posted @ 2013-03-21 10:19 行者1992 阅读(167) 评论(0) 推荐(0) 编辑