- 博客(15)
- 资源 (2)
- 收藏
- 关注
原创 Codeforces Round #166 (Div. 1) && (Div. 2)
D 题 SOL:就是要寻找满足某一条件的不同字串个数。 后缀数组解决!!!#include#include#includeusing namespace std;const int MAXN=2010;char r[MAXN];int sa[MAXN];int wa[MAXN],wb[MAXN],wv[MAXN],ws[MAXN];
2013-05-31 18:35:59 705
原创 POJ 3468 A Simple Problem with Integers
SOL:也是颗裸的Splay Tree。。。套模版就好了。改改预处理神马的就Ok啦。 /* * POJ 3468 模版题 */# include# include using std::swap;using std::max; # define LL long long # define inf 1<<29# define keytree
2013-05-31 17:54:50 556
原创 TYVJ P1742 - [NOI2005]维护序列
SOL:用了这么强大的数据结构。。。看到这句话就学习了“三鲜师傅评论说splay-tree功能更强大,并且有很多其他数据结构无法实现的功能”。这功能各种强大,运用函数比较多。慢慢理解吧~看完这个突然对线段树恍然大悟啊。 # include# include using std::swap;using std::max; # define LL long lo
2013-05-31 16:47:29 764 1
原创 Codeforces Round #186 (Div. 2)
A 题水题,如果n#include #include using namespace std;int main(){ int n,ans; scanf("%d",&n); if(n>=0) printf("%d\n",n); else { n=-n; ans=-(n/100*10+min(n%10,n/10%10)); pri
2013-05-31 08:33:44 1014
原创 UVALive 3027 Corporative Network
Sol:依然是水水的并查集。不过这里需要维护一个dist的数组就好(dist就是每个节点到其父亲节点的距离,在路径压缩时维护即可!!!) #include #include #include using namespace std;const int maxn =20000+10;int pa[maxn],dist[maxn];inlin
2013-05-29 16:44:11 425
原创 UVALive 3644 X-Plosives
Sol:水水的冰茶几。。。。 #include using namespace std;const int maxn= 100000+10;int pa[maxn];int findset(int x){ return pa[x] !=x ? pa[x]=findset(pa[x]) :x;}int main(){ int x,
2013-05-29 16:42:17 614
原创 UVA 11806 Cheerleaders
sol:容斥原理。。。ANS = C (row*col , k ) (row,col均是剩余的行和列~~~) >_ #include #include using namespace std;const int maxn=500;const int MOD=1000007;int C[maxn+10][maxn+10];void init()
2013-05-29 14:07:31 509
原创 UVA 11401 Triangle Counting
sol:数学题,计数问题 递推公式:F[N]=F[N-1] + C [n] ; C[n] = 1/2 ((x-1)(x-2)/2 - (x-1)/2 ); #include using namespace std;typedef long long LL;const int maxn=1000000+10;LL f[maxn];int m
2013-05-29 14:02:18 546
原创 UVA 11538 Chess Queen
题意:给你个n*m的棋盘,问你有多少种方法放置两个相互攻击的皇后?Sol:利用加法原理A+B+C(A:同一行的方案数,B:同一列的方案数,C:对角线的方案数)A=nm(m-1) B=nm(n-1) C=(2n(n-1)(3m-n-1))/3 ; #include #include using namespace std;typedef unsigned l
2013-05-29 13:59:29 480
原创 HDU 3544 Alice's Game
就是博弈,简单博弈啊。后面的那位孩纸会尽量切前面那位妹纸切后的小块切~~~ 多有爱! #include using namespace std;int main(){ long long a,b,x,y; int T,Icase=0,N; scanf("%d",&T); while(T--) { scanf("%d",&N); a=b=0
2013-05-28 21:30:14 626
原创 HDU 3371 Connect the Cities
水题MST吧。。对于这种模版题,我已经可以不用做了。。。。冲刺东北赛!!!!Problem : 3371 ( Connect the Cities ) Judge Status : AcceptedRunId : 8394387 Language : C++ Author : CherryChouCode Render Status : Rendered By
2013-05-28 10:48:57 592
原创 Codeforces Round #185 (Div. 1) && (Div. 2)
Div 2A 模拟。模拟。模拟。我看错了一句话,最近总是犯这种毛病。。。According to his experience, he thought that Freda always said "lala."at the end of her sentences, while Rainbow always said "miao." at thebeginning of his sen
2013-05-27 18:09:38 585
原创 NEFU 697 2013内蒙古自治区赛--热身赛 E题
擦,这题,现场用kmp被卡了。。。唉,还是不稳定,写错了。。。能力不足,但是在结束的3min敲了个无脑的暴力。擦你妹的过了,蛋疼啊,节操何在。#include #include using namespace std;int main(){ string s1,s2; while(cin>>s1>>s2) { s1=s1+s1; int a=s1.fin
2013-05-25 19:24:07 964
原创 HDU 2544 最最裸的最短路
Dijkstra + HeapProblem : 2544 ( 最短路 ) Judge Status : AcceptedRunId : 8360313 Language : G++ Author : CherryChouCode Render Status : Rendered By HDOJ G++ Code Render Version 0.01 Beta
2013-05-22 18:55:25 732
原创 ZOJ1406 || POJ 1251 Jungle Road,就是道裸的MST。。。。
Prime+heap+邻接矩阵Source CodeProblem: 1251 User: imutzcyMemory: 740K Time: 0MSLanguage: G++ Result: AcceptedSource Code# include# include# include#
2013-05-22 15:05:23 524
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人