08 2014 档案

摘要:1 bool lexicographicalSmaller(vector a, vector b) 2 { 3 int n = a.size(); 4 int m = b.size(); 5 for(int i = 0; i 2 bool lexicographicalS... 阅读全文

posted @ 2014-08-31 11:44 LLGemini 阅读(446) 评论(0) 推荐(0)

摘要:介意转吗博主~~http://blog.csdn.net/thestoryofsnow/article/details/6822576,我知道不介意啦~ 问题:如何检测一个链表是否有环,如果有,那么如何确定环的起点. 龟兔解法的基本思想可以用我们跑步的例子来解释,如果两个人同时出发,如果赛道... 阅读全文

posted @ 2014-08-24 23:46 LLGemini 阅读(2322) 评论(0) 推荐(0)

摘要:1 inline int readint() 2 { 3 char c = getchar(); 4 while(!isdigit(c)) c = getchar(); 5 6 int x = 0; 7 while(isdigit(c)) 8 { 9 ... 阅读全文

posted @ 2014-08-23 23:53 LLGemini 阅读(285) 评论(0) 推荐(0)

摘要:1 typedef long long ll; 2 #define MOD 1000000007 3 ll pow_mod(ll a, ll n) 4 { 5 if(n == 0) return 1; 6 ll x = pow_mod(a, n/2); 7 ll ans ... 阅读全文

posted @ 2014-08-21 15:44 LLGemini 阅读(139) 评论(0) 推荐(0)

摘要:POINT : 质因子分解;(仅给题解)http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1721题意:给你两个整数m和n,求最大的k使... 阅读全文

posted @ 2014-08-21 13:30 LLGemini 阅读(168) 评论(0) 推荐(0)

摘要:首先上模板(不断更新中...)(根据刘汝佳AOAPCII修改) 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 1... 阅读全文

posted @ 2014-08-20 17:19 LLGemini 阅读(417) 评论(0) 推荐(0)

摘要:1.两个素数A, B, A<=B, 若其和也为素数,则其中一个必为2; 阅读全文

posted @ 2014-08-20 14:25 LLGemini 阅读(161) 评论(0) 推荐(0)

摘要:http://blog.csdn.net/wiking__acm/article/details/84489001.5 快速找出机器故障问题描述:有很多的ID(可能位数很大),其中只有一个ID出现的次数小于2,其他正常ID出现的次数都等于2,求这个次数为1的ID精彩解法:将所有的数从头到尾异或一遍,... 阅读全文

posted @ 2014-08-15 09:40 LLGemini 阅读(224) 评论(0) 推荐(0)

摘要:过桥问题和倒水问题都是笔试面试中的热门智力题,不但微软、GOOGLE、百度、腾讯等公司采用,甚至在IQ测试与公务员考试中都能见到。本文不但教你如何快速用手算来解决这两种问题,并且教你如何用程序代码来计算这两种问题。绝对让你大有收获。一.过桥问题 在漆黑的夜里,四位旅行者来到了一座狭窄而且没有护... 阅读全文

posted @ 2014-08-11 17:57 LLGemini 阅读(225) 评论(0) 推荐(0)

摘要:为什么都说简单好想咧。坦白从宽看了人家的代码,涨了好多姿势,,http://blog.csdn.net/u013382399/article/details/38227917被一个细节坑了。。2147483647是0x7fffffff啊啊啊,7个f!!! 1 #include 2 #inclu... 阅读全文

posted @ 2014-08-11 10:38 LLGemini 阅读(315) 评论(0) 推荐(0)

摘要:POINT: 如何判断是否包含连续重复子串? 判断当前串的 后缀 啦~~~You have been employed by the organisers of a Super Krypton Factor Contest in which contestants have very high ... 阅读全文

posted @ 2014-08-10 23:30 LLGemini 阅读(196) 评论(0) 推荐(0)

摘要:(此位老兄的讲解深得我意,特来推荐:http://blog.csdn.net/insistgogo/article/details/8579597) 有N件物品和一个容量为V的背包。第i件物品的费用是c[i],价值是w[i]。求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最... 阅读全文

posted @ 2014-08-07 16:23 LLGemini 阅读(246) 评论(0) 推荐(0)

摘要:注意:抽象成以下描述即为最长非降/下降子序列问题(一维状态)问题描述:在一个无序的序列a1,a2,a3,a4…an里,找到一个最长的序列满足:(不要求连续) aiaj>ak…>am,且i= array[i][0] && array[j][1] > len) //注意此处的判断条件 ... 阅读全文

posted @ 2014-08-07 00:27 LLGemini 阅读(387) 评论(0) 推荐(0)

摘要:DescriptionAn array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very r... 阅读全文

posted @ 2014-08-05 20:09 LLGemini 阅读(502) 评论(0) 推荐(0)

摘要:转载请注明出处:優YoU http://user.qzone.qq.com/289065406/blog/1301845324大致题意:一根两端固定在两面墙上的杆 受热弯曲后变弯曲。求前后两个状态的杆的中点位置的距离解题思路:几何和二分的混合体 如图,蓝色为杆弯曲前,长度... 阅读全文

posted @ 2014-08-05 14:34 LLGemini 阅读(343) 评论(0) 推荐(0)

摘要:POINT: 把每个元素看成顶点,则一个简单化合物就是一条无向边,若存在环(即k对组合中有k种元素),则危险,不应该装箱,反之,装箱; 用一个并查集维护连通分量集合,每次得到一种化合物(x, y)时检查x, y是否在同一集合中,如果是,拒绝,反之接受。并查集 并查集是一种树型的数据结构,用于处... 阅读全文

posted @ 2014-08-05 09:33 LLGemini 阅读(246) 评论(0) 推荐(0)

摘要:题目描述: 有n个矩形,每个矩形可以用a,b来描述,表示长和宽。矩形X(a,b)可以嵌套在矩形Y(c,d)中当且仅当a 2 #include 3 #include 4 #include 5 using namespace std; 6 #define maxn 1000+10//矩形的最大个数 7 ... 阅读全文

posted @ 2014-08-04 16:55 LLGemini 阅读(502) 评论(0) 推荐(0)

摘要:题目描述Description如图所示的数字三角形,从顶部出发,在每一结点可以选择向左走或得向右走,一直走到底层,要求找出一条路径,使路径上的值最大。 输入描述Input Description第一行是数塔层数N(1 2 #include 3 #include 4 #include 5 using ... 阅读全文

posted @ 2014-08-04 16:51 LLGemini 阅读(300) 评论(0) 推荐(0)

摘要:第一遍,刘汝佳提示+题解;回头再看!!!POINT: dp[time][sta]; 在time时刻在车站sta还需要最少等待多长时间; 终点的状态很确定必然是的 dp[T][N] = 0 ---即在T时刻的时候正好达到N站点 我们可以 从终点的状态往起始的状态转化, 一步步走就可以了。 h... 阅读全文

posted @ 2014-08-04 16:47 LLGemini 阅读(233) 评论(0) 推荐(0)