上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 44 下一页
摘要: 题目链接这个匹配矩阵,很有特点,鼓励相同,鼓励匹配,不鼓励匹配空。状态转移很类似于LCS,初始化做好,OK了。 1 #include <cstring> 2 #include <string> 3 #include <cstdio> 4 #include <iostream> 5 using namespace std; 6 int c[5][5] = {{5,-1,-2,-1,-3},{-1,5,-3,-2,-4},{-2,-3,5,-2,-2},{-1,-2,-2,5,-1},{-3,-4,-2,-1,0}}; 7 char s1[101], 阅读全文
posted @ 2013-01-22 10:11 Naix_x 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 题目链接无语的一个题。做法是普通的O(n^2)的DP,这个题啥意思啊。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <vector> 6 using namespace std; 7 int dp[101],p[101],o[101]; 8 int f(int a,int b) 9 {10 return a < b ? a:b;11 }12 int main()13 {14 int t, 阅读全文
posted @ 2013-01-21 19:32 Naix_x 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 题目链接开始看错题了,导致一直没找到节奏,看宝哥题解过的。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <string> 5 #include <map> 6 #include <algorithm> 7 #include <queue> 8 #include <vector> 9 using namespace std;10 #define C 7500 11 int dp[21][20001];12 阅读全文
posted @ 2013-01-21 15:40 Naix_x 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 题目链接水过啊。初看此题,一点想法没有。然后不知从何暴力啊,看看DISCUSS,说利用四色定理可知,4种颜色可完全染色。然后有点思路了,从1种颜色枚举到3种颜色。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <string> 5 #include <map> 6 #include <algorithm> 7 #include <queue> 8 #include <vector> 9 using nam 阅读全文
posted @ 2013-01-20 16:10 Naix_x 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 题目链接写的真慢。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <string> 5 #include <map> 6 #include <algorithm> 7 #include <queue> 8 #include <vector> 9 using namespace std;10 char str[101];11 int n,len,ans,o[101],a[101];12 int z;13 v 阅读全文
posted @ 2013-01-20 13:51 Naix_x 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目链接想起了一句名言。。。只要常数卡的好,没有暴力过不了。裸暴力超时了,加上一个标记,时间优化一半,然后就1100+水过去了。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <string> 5 #include <map> 6 #include <algorithm> 7 #include <queue> 8 #include <vector> 9 using namespace std;10 int 阅读全文
posted @ 2013-01-20 13:18 Naix_x 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 题目链接倒水问题。1Y。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <string> 5 #include <map> 6 #include <algorithm> 7 #include <queue> 8 #include <vector> 9 using namespace std; 10 int quea[100000],queb[100000],pre[100000],o[101][101]; 阅读全文
posted @ 2013-01-20 11:32 Naix_x 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 题目链接蒙姐跟我说了题意,就很简单了,类似打扑克中的插牌。磕磕绊绊,终于把POJ第三次训练刷完了。 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <string> 5 #include <map> 6 #include <algorithm> 7 using namespace std; 8 char s1[101],s2[101],aim[201],str[201]; 9 map<string,int> mp;10 阅读全文
posted @ 2013-01-19 21:25 Naix_x 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 题目链接做了好久,看题,想用BFS还是DFS,写出来各种单步,最后1Y还是比较高兴。。这种找最短步数一般是BFS的,但是发现状态一直在变,用DFS写起来比较方便,把题目看清楚就OK了。解释一下题意:一个球从起点出发,到终点,最少需要人动几次,规则,如果出了棋盘,游戏结束,如果碰到木块,木块消失,人为可以选择方向,大体就是这样。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <map> 5 #include <cstring> 6 #i 阅读全文
posted @ 2013-01-19 11:04 Naix_x 阅读(335) 评论(0) 推荐(0) 编辑
摘要: 题目链接不会做,概率论学的不好啊。看的这个题解,这里面好像有点错误,sum[i][j]数组,表示第i个队伍解出0,1,2...j的题目概率的和。这个问题主要是转化,和怎么计算,状态转移很常见,如果想不出怎么计算,肯定挂。初始化问题,让我错了几次,这是多久没写题了啊。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <map> 5 #include <cstring> 6 #include <cmath> 7 using na 阅读全文
posted @ 2013-01-19 09:35 Naix_x 阅读(157) 评论(2) 推荐(0) 编辑
摘要: 题目链接开始想用map的,字典序不会搞,还是老老实实的用trie树把。好久没写了,忘得差不多了。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <map> 6 #include <cmath> 7 #include <string> 8 #include <queue> 9 #include <vector>10 #include <alg 阅读全文
posted @ 2013-01-18 20:26 Naix_x 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 题目链接想了想 真没思路。。。然后搜一下题解,这个题解讲的很好。此问题是K路归并的加强版,K路归并好像听说过。对STL里的优先队列,不熟啊。。直接看的别人的代码,学习结构体的优先队列,还有开一个标记数组去记录。。。这样还错了好几次。。分析还是去看那个题解把。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <cmath> 6 #include <string> 7 #include 阅读全文
posted @ 2013-01-17 14:50 Naix_x 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 题目链接题意:一个队列,一直往里插入元素,n次询问,第i次询问,询问第i小的元素。划分树不知道能不能破(可能会超时),这个题目插入次数和询问次数都很大,但是询问是有规律的。建立两个堆,一个大顶堆,一个小顶堆,然后直接上STL就可以了。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <cmath> 6 #include <string> 7 #include <queue> 阅读全文
posted @ 2013-01-17 11:08 Naix_x 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题目链接给n个点,找有多少个正方形。忘记初始化了。。。纳闷哈希为毛线一直TLE呢,明显不科学啊。。。哈希跑的还是比较快的,乱搞随便一个哈希函数,跑了500+。还有 知道对角线两点坐标,求另外两点。。。懒的手推,百度知道上有。。。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <cmath> 6 #include <string> 7 using namespace std; 8 # 阅读全文
posted @ 2013-01-15 16:46 Naix_x 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 题目链接模版题。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <cmath> 6 #include <algorithm> 7 #include <set> 8 #include <map> 9 #include <vector>10 #include <queue>11 #include <ctime>12 using 阅读全文
posted @ 2013-01-15 10:31 Naix_x 阅读(186) 评论(0) 推荐(0) 编辑
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 44 下一页