上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 44 下一页
摘要: 题目链接很难想。会哈希,但是想不出。需要一个转化,本来是求某一段上的二进制上每一位的1数目相等,转化为找两段相等的,换元可推出公式。最后注意特判。。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <string> 5 using namespace std; 6 #define MOD 97777 7 struct node 8 { 9 int data;10 struct node *next;11 }*head[MOD],hash[60000 阅读全文
posted @ 2013-01-14 19:09 Naix_x 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 题目链接kmp专题剩下的题,没看清题目要求字典序最小,开始加了最优的剪枝,长度相同的时候直接continue了,导致再去改字典序的时候没改这句话,错了几次。又到了放假切题的时候了。。 1 #include <cstdio> 2 #include <cmath> 3 #include <cstring> 4 using namespace std; 5 char s[11][101]; 6 int next[301]; 7 int kmp(int L,int R,int x) 8 { 9 int i,j,len1,len2;10 char str[101];1 阅读全文
posted @ 2013-01-01 19:54 Naix_x 阅读(224) 评论(2) 推荐(0) 编辑
摘要: 各种考试,17周搞完,最后出去沈阳实训。 考试虽然各种不会,但是相信自己一定可以全过的。 也没空去刷题了,要认认真真的看书,先把考试水过再说。 不懂的要请教别人,学习的时候集中精神,学一点就多会一点。 还有CET4啊,压力好大啊。 如果把期末搞好了,这个学期圆满了。 加油!!!Frighting!!! 埋头苦学ing..... 阅读全文
posted @ 2012-12-18 18:49 Naix_x 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题目链接今天比赛各种没状态,交错语言,各种二货错误。。。这个题我乱搞过的,zyj从CF上找的,这个题,仔细的想一下,就可以发现一个结论,如果这一段里只有两个字母且这俩字母还敌对,那么就把把较少的删除。。枚举每一种敌对关系,遍历一遍就行了。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <map> 6 #include <queue> 7 using namespace std; 8 阅读全文
posted @ 2012-12-15 19:49 Naix_x 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目是SRM 564 DIV2的250,在小花姐的指导下,终于搞明白了TC的代码格式了。。。其实自己老早就应该学会的,类神马的,用的真是不熟。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 using namespace std; 6 char str[1000000]; 7 class FauxPalindromes 8 { 9 public:10 string classifyIt(string word)11 {12 阅读全文
posted @ 2012-12-13 12:51 Naix_x 阅读(283) 评论(0) 推荐(0) 编辑
摘要: 题目链接考虑各种情况,然后注意敲的稳一点,忘考虑一种情况,2Y. 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <queue> 5 #include <string> 6 #include <map> 7 using namespace std; 8 char word[10001][21]; 9 char s[21]; 10 int len[10001]; 11 int Abs(int x) 12 { 13 if(x & 阅读全文
posted @ 2012-12-13 11:31 Naix_x 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题目链接最大流还是理解的不好,稍微变化了一点,就不会了,看了别人拆点的思路后,错了几次,过了,输出路径写了个dfs+标记乱搞了一下。注意建图的时候源点到某一个点,不一定全是0,有2也可以。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <queue> 5 using namespace std; 6 const int INF = 0xffffff; 7 int s[51][51]; 8 int flow[201][201],low[201],p 阅读全文
posted @ 2012-12-12 15:23 Naix_x 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 题目链接算是一个模版题把。构造一个源点和汇点,所有的核电站都是从源点出发的,所有的用户都汇集到汇点,跑一次最大流就可以了。模版敲的不是很熟。 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 using namespace std; 5 const int INF = 0xffffff; 6 int flow[201][201],low[201],path[201]; 7 int str,end,n; 8 int bfs() 9 {10 int t,i;11 queue<int& 阅读全文
posted @ 2012-12-11 16:55 Naix_x 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 题目链接无向二分图的最小路径覆盖 = 顶点数 – 最大二分匹配数/2看题解过的。看了网上的题解,说是拆点,然后把所有的城市分为两个集合,然后用匈牙利算法计算出最大二分图匹配。 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 char str[51][51]; 5 int p[501][501],used[501],linker[501],o[51][51]; 6 int x[4] = {0,0,1,-1}; 7 int y[4] = {1,-1,0,0}; 8 int num; 9 in 阅读全文
posted @ 2012-12-11 16:01 Naix_x 阅读(122) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2012-12-10 19:09 Naix_x 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 第三个题,自己sb不解释啊。。想了1个小时+,愣是没想清楚过程,好在前两个还算比较稳,rating小升,第一次上1600+。。。第一个题,题意很简单,刚想开敲,发现如果有很多重复的不好哈希,有点激动了,好在想了几分钟后,乱搞一种,边哈希,一边输出的办法,10分钟。 1 #include <cstdio> 2 #include <cstring> 3 #include <string> 4 #include <map> 5 #include <queue> 6 #include <vector> 7 #include < 阅读全文
posted @ 2012-12-10 10:38 Naix_x 阅读(201) 评论(2) 推荐(0) 编辑
摘要: 题目链接题意也是挺难懂的。把所有的A,S看成一个点,求这些点的最小生成树。先BFS预处理出来然后prim,注意m,n后边的空格问题,然后数组开小了,也错了次。 1 #include <cstdio> 2 #include <cstring> 3 #include <string> 4 #include <iostream> 5 using namespace std; 6 int p[1001][1001],low[1001]; 7 char str[101][101]; 8 int o[301][301],key[301][301],n,m,k 阅读全文
posted @ 2012-12-08 11:19 Naix_x 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 题目链接最大二分图匹配 = 最小点覆盖。。。上匈牙利模版。。 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 int p[501][501],used[501],linker[501]; 5 int n; 6 int dfs(int x) 7 { 8 int i; 9 for(i = 1; i <= n; i ++)10 {11 if(p[x][i]&&!used[i])12 {13 used[i] = 1;14 ... 阅读全文
posted @ 2012-12-06 18:52 Naix_x 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 题目链接经讲解后过了,对题意和拓扑排序都不怎么会。正向建图,找标号小的入度为0的点,是错误的。。。正解反向建图,然后把找到标号大的入度为0的点,然后把大的重量赋给他。如何证明的,我不懂。。。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 using namespace std; 5 int p[201][201],in[201],out[201],o[201],n; 6 int judge() 7 { 8 int i,j,t,z; 9 for(i = n; i >= 1; i 阅读全文
posted @ 2012-12-06 16:08 Naix_x 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 题目链接其实我不懂拓扑排序啊。。。看了DISCUSS,需要判断是不是有环,我傻呼呼的写了个DFS。。。拓扑排序没学好啊。。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 #include <algorithm> 6 using namespace std; 7 char str[10001][4],ch[31]; 8 int in[50],out[50],o[301],in2[50],out2[50],z[27]; 阅读全文
posted @ 2012-12-06 09:29 Naix_x 阅读(150) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 44 下一页