- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 zoj 3574 Under Attack II//归并排序
求逆序对。其实,就是求交点。利用了归并排序的稳定性。 #include #include #include using namespace std; class node { public: int ly,ry; int num; }; node date[30005],temp[30005]; int ans=0; int cmp(const void *a,const void *b)
2012-02-28 19:31:49 674
原创 ZOJ 1610Count the Colors//线段树
线段树好长时间没写,这次自己敲了一遍,居然没错。 线段树核心:每次有更新时,并没有更新到叶节点,而是保存下来,待需要更新的时候,才做这些事。 注意:线段树的叶节点,可以是(x,x+1) 或者(x,x)。不同的是创建的时候。一个mid不需+1,另一则要求有。 #include #include using namespace std; const int maxlen =8011; class
2012-02-27 14:09:05 359
原创 hdu1717 小数化分数2
参照:http://www.cnblogs.com/Yu2012/archive/2011/09/22/2184764.html #include #include #include #include using namespace std; int gcd(int a,int b) { int temp=0; while(b!=0) { temp=a%b; a
2012-02-24 19:33:08 470
原创 ZOJ Alice's Sequence II //矩阵乘法
矩阵乘法果然犀利! #include #include #include using namespace std; const int man=35; const int mod=10000007; char kk[10]="rdasit"; #define ll long long class node { public: ll a[man][man]; }; node date,ma
2012-02-21 00:24:37 446
原创 中山大学 1238: 兵临城下//优先队列
维护两队列。 #include #include #include using namespace std; class node1 { public : int time,pth; }; bool operator< (const node1 &a,const node1 &b) { return a.pth >b.pth ; } class node2 { public : int t
2012-02-17 16:48:56 490
原创 中南大学-1239: 审阅文稿//kmp
再次了解kmp! #include #include #include using namespace std; char st1[20001],st2[12000001]; int next[1000001]; bool equ(int i,char a[],int j,char b[]) { if(a[i]==b[j]&&a[i+1]==b[j+1]) return true; retu
2012-02-15 22:55:01 671
原创 ZOJ 3490 String Successor//字符串处理
原来,原来,这句漏掉了“the left of the leftmost alphanumeric” (z)的后继是(aa) o(╯□╰)o 细心很重要。 #include #include #include using namespace std; bool alph(char str[]) { int len=strlen(str),i; for(i=0;i<len;i++
2012-02-01 19:29:26 1181
创建学生信息管理系统
2010-12-06
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人