09 2015 档案

摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() { 7 int x; 8 while(cin >> x) { 9 x = (x & 1) ? ( ( x & ((-... 阅读全文
posted @ 2015-09-30 16:36 悠悠我心。 阅读(269) 评论(0) 推荐(0)
摘要:桶排序 阅读全文
posted @ 2015-09-23 14:45 悠悠我心。 阅读(137) 评论(0) 推荐(0)
摘要:代码: 1 #include 2 3 int add(int a, int b) { 4 if(a == 0 || b == 0) { 5 return a ^ b; 6 } 7 return add( (a&b) >= 1;25 }26 ... 阅读全文
posted @ 2015-09-23 09:22 悠悠我心。 阅读(162) 评论(0) 推荐(0)
摘要:大意:求最长回文字串:分析:1、暴力方法。。枚举头尾,判断是不是回文串 0(n^3)3、寻找中点往两边暴力 n^2代码 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 55; 7 8... 阅读全文
posted @ 2015-09-22 13:43 悠悠我心。 阅读(164) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 using namespace std; 4 5 typedef int type; 6 7 template 8 struct Node { 9 T data;10 Node *next;11 Node() {1... 阅读全文
posted @ 2015-09-15 18:01 悠悠我心。 阅读(153) 评论(0) 推荐(0)
摘要:大意:告诉你有n个点 m个边的无向图 然后问有多少点对 他们的路径上节点之间的距离都少于 x分析:并查集代码: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const long long ma... 阅读全文
posted @ 2015-09-15 15:39 悠悠我心。 阅读(212) 评论(0) 推荐(0)
摘要:给定一个单词a,如果通过交换单词中字母的顺序可以得到另外的单词b,那么定义b是a的兄弟单词,例如单词army和mary互为兄弟单词。现在给定一个字典,用户输入一个单词,如何根据字典找出这个单词有哪些兄弟单词?要求时间和空间效率尽可能的高。方案一:用hash来做 head中保存的是 排好序的字母顺序 ... 阅读全文
posted @ 2015-09-07 01:00 悠悠我心。 阅读(194) 评论(0) 推荐(0)
摘要:1、这个世界,能理解你的人只有你自己。 阅读全文
posted @ 2015-09-07 00:35 悠悠我心。 阅读(139) 评论(0) 推荐(0)
摘要:字典树 这一个比较简单 现在回顾也挺简单直接给出模板 有什么不会的直接去模板里理解 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 500005; 7 int tire[maxn][26... 阅读全文
posted @ 2015-09-06 18:34 悠悠我心。 阅读(195) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 const int MAXN=550; 8 const double eps=1e-8; 9 10 struct Po... 阅读全文
posted @ 2015-09-05 16:45 悠悠我心。 阅读(166) 评论(0) 推荐(0)