摘要: 这是一个水水的水题,排序再查找。贴代码:#include #include struct node{ int a[6];}snow[100005];int cmp1(const void *a,const void *b){ return *(int *)a-*(int *)b;}int... 阅读全文
posted @ 2013-08-14 20:39 、小呆 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 标准并查集模版题,不多说贴模板。#include int a[30005];int find1(int f){ while(a[f]!=f) { f=a[f]; } return f;}int main(){ int n,m; while(scanf... 阅读全文
posted @ 2013-08-14 19:41 、小呆 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 做完这题长知识了,原来求逆序数可以用排序的交换次数来计算。但仅限于稳定的排序,用快排这类不稳定的办不了。下面是代码:#include #include long long a[500005],temp[500005];long long ans;void mergearray(int first, ... 阅读全文
posted @ 2013-08-14 15:27 、小呆 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 这也是水题一道啊,STL各种解法,水水的。于是乎借着这个题学习了一下nth_element。下面是水水的代码:#include #include using namespace std;int main(){ int n; while(scanf("%d",&n)!=EOF) { ... 阅读全文
posted @ 2013-08-14 10:22 、小呆 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 这题也是水题,暴力遍历0MS水过轻松加愉快。不解释直接贴代码:#include #include int main(){ char s1[100005],s2[100005]; while(scanf("%s",s1)!=EOF) { scanf("%s",s2); ... 阅读全文
posted @ 2013-08-14 09:56 、小呆 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 这个题很容易,直接以第一个字符串为母串,枚举其中的子串查找其他串里是否存在,0MS水过。直接暴力枚举,贴代码:#include #include int main(){ int t; scanf("%d",&t); while(t--) { int n,flat... 阅读全文
posted @ 2013-08-14 09:42 、小呆 阅读(146) 评论(0) 推荐(0) 编辑