上一页 1 2 3 4 5 6 7 ··· 42 下一页
ps:D题挂了,最后只有三个。。。。E题是赛后看着一群大神的代码YY的(网上找不到题解,好奇怪,肿么都没人写的)之所以这么迟是因为一直在纠结E题A:如果第一个人能放,那就放在中间的位置,然后第二个人不管放哪第一个人总有对称的放法B:水题C:简单贪心,错了一次D:给你一幅图,假如在地板上铺上无限的同样的图,判断从S出发能否走到无限远的地方只需要判断能否从一幅图的一个点走到相对位置相同的另一幅图中的那个点即可,通过取余来表示无限幅地图E:给你一棵树,然后又给你坐标图上的n个点,让你按照树的构成将坐标连接起来,即给所有的坐标点一个编号,将树种的点与坐标对应起来树中相交的边 在坐标中体现 的线段也相交 Read More
posted @ 2012-06-13 22:00 Because Of You Views(976) Comments(0) Diggs(1) Edit
The 1995 Rudy Tomjanovich-coached Houston Rockets basketball team were defending NBA champions, but they entered the NBA playoffs with a low seed after a poor regular season. The Rockets went on to defeat the top four seeds, winning seven straight games at one point of the playoffs. “Never underesti Read More
posted @ 2012-06-13 21:24 Because Of You Views(558) Comments(0) Diggs(0) Edit
对KMP的熟练使用View Code 我的代码 kmp匹配过去,需要熟练掌握KMP,数据范围大一点也没关系#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn = 100010;int n,mb,mc;char a[maxn],b[maxn],c[maxn];int p1[maxn],p2[maxn];void getp(int p[],int m,char b[]){ p[1]=0; int i,j=0; for(i=2;i<=m; Read More
posted @ 2012-06-12 18:25 Because Of You Views(299) Comments(0) Diggs(0) Edit
前两题做的还算快,可是最后却没有出题了,原因是题目都看不懂,特别是D题,真想骂几句,这神马意思啊最后由于做的比较快居然还涨rating了, ——!E题,并查集的带权合并 w[x]表示x到根的权值和在find的时候合并掉View Code #include<cstdio>const int maxn = 100010;const int mod = 1000000007;int w[maxn],p[maxn];int find(int x){ if(x==p[x]) return x; int z=find(p[x]); w[x]+=w[p[x]]; w[x]%=mod... Read More
posted @ 2012-06-11 13:41 Because Of You Views(309) Comments(0) Diggs(0) Edit
这几个题A的好不容易啊!!!留念一下树链剖分初体验:可以解决 询问一棵树上点对间的简单路径的长度 边权的最大值最小值,并支持动态修改边权,注意,树的形态始终没有改变另外,点权的变化可以转换为边权,即每个点的点权都转移到与父节点的边之间的边权上,根节点特殊判断spoj 375贴上我巨搓无比的代码,虽然没有别人的短,虽然没有别人的快,但是毕竟它A了 -_-!!!View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;#define lson l,m,rt& Read More
posted @ 2012-06-08 20:12 Because Of You Views(2043) Comments(0) Diggs(0) Edit
水哈希,将哈希值相同的映射放入一个槽内既可,哈希函数是对一个素数取余View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn = 4100;struct edge{ int v,next,num;}edge[3999972];int head[3999972];int hash(int num){ return (num+3899971)%3999971;}int tot;void add_edge(int num){ in Read More
posted @ 2012-06-05 15:37 Because Of You Views(969) Comments(0) Diggs(0) Edit
突然发现这题和省赛的线段树类型一模一样的啊,可恨早没有做In one well-known algorithm of finding thek-th order statistics we should divide all elements into groups of five consecutive elements and find the median of each five. A median is called the middle element of a sorted array (it's the third largest element for a group Read More
posted @ 2012-06-04 05:15 Because Of You Views(703) Comments(1) Diggs(0) Edit
A : 暴力枚举B:找规律,也可以用数学方法找最小的x使得 a*x%b == 0 a,b已知(a=4*n b=n+1)x是所走的圈数,易得只要把x只要等于 b/gcd(a,b) 就满足了 然后答案就是a*x/b 即a/gcd(a,b)还要加上1,因为出发前就在1的位置走了一步了 所以答案 : a/gcd(a,b)+1;B题开始太草率了,被人黑了,于是又回来看B题,有点慌,直接导致没出题,raiting掉了。C:给你一个字符矩阵,由 '#' 和 ‘.’ 组成 问你最少去掉几个'#'就能使得'#'不连通由样例可得,不管什么图,最多去掉两个'# Read More
posted @ 2012-06-04 03:54 Because Of You Views(241) Comments(0) Diggs(0) Edit
k很小,每个可以保存覆盖0~k次的区间和,k次以上全算k次,可以做模板了View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;typedef long long lld;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1const int maxn = 60000;int sum[maxn<<2][15];int cov[maxn<<2];int x[max Read More
posted @ 2012-06-03 09:29 Because Of You Views(585) Comments(0) Diggs(0) Edit
题意,给你n个数,让你求第k大的连续区间和是多少例如3 41 4 2最大的区间和 1 4 2第二大 4 2第三大 1 4第四大即答案 4首先要看出单调性:枚举的和越大,区间和大于它的区间数就越少所以可以采用二分+树状数组统计的方法二分答案,再n * log(n)判断有几个区间的区间和大于mid,然后调整上下界,使这个值不断的接近k。判断符合条件的区间总数:线性扫描s【】(前n项和) 每次判断以i结尾的区间有几个区间和大于等于mid,累加即可View Code #include<cstdio>#include<cstring>#include<algorithm&g Read More
posted @ 2012-06-01 21:13 Because Of You Views(868) Comments(0) Diggs(0) Edit
上一页 1 2 3 4 5 6 7 ··· 42 下一页