上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页
摘要: 这题定义了一种新的排序算法,就是把一串序列中的一个数,如果它右边的数比它小则可以往右边移动,直到它右边的数字比它大为止。易得,如果来模拟就是O(n^2)的效率,肯定不行想了一想,这个问题可以被转化成求这一串序列当中每个元素,它的右边是否存在小于它的数字,如果存在,则++ans一开始没想到诶= = 不... 阅读全文
posted @ 2014-11-30 21:27 Jeremy Wu 阅读(229) 评论(0) 推荐(0)
摘要: m位长度,S为各位的和利用贪心的思想逐位判断过去即可详细的注释已经在代码里啦~//#pragma comment(linker, "/STACK:16777216") //for c++ Compiler#include #include #include #include #include #in... 阅读全文
posted @ 2014-11-26 16:18 Jeremy Wu 阅读(414) 评论(0) 推荐(0)
摘要: 这题第一次看的时候以为是区间替换,后来发现看错了,只是单纯的元素替换。解题思路: 先对输入的序列加个数组排个序 遍历下来,如果和排序后的结果当前元素不同,设当前位置为 i, 则往下面找,设查找位置为j 使得满足 a[j] == b[i] && a[j] != b[j] 一次遍历即可。易得证/... 阅读全文
posted @ 2014-11-24 09:31 Jeremy Wu 阅读(225) 评论(0) 推荐(0)
摘要: 矩阵的 OR ,也是醉了。题目意思很简单,就是问你有没有这么一个矩阵,可以变化,得到输入的矩阵。要求是这个矩阵每行都可以上下任意移动,每列都可以左右任意移动。解题方法: 1.也是导致我WA 的原因,首先要判断是否是一个零矩阵,如果是一个零矩阵,那么YES输出 2.判断输入矩阵存在1的那个位置,在... 阅读全文
posted @ 2014-11-22 22:51 Jeremy Wu 阅读(229) 评论(0) 推荐(0)
摘要: 一个DLX模板阿/*1 0 0 1 0 0 11 0 0 1 0 0 00 0 0 1 1 0 10 0 1 0 1 1 00 1 1 0 0 1 10 1 0 0 0 0 12 4 61 0 0 1 0 0 00 0 1 0 1 1 00 1 0 0 0 0 1*/#include #includ... 阅读全文
posted @ 2014-11-20 15:14 Jeremy Wu 阅读(175) 评论(0) 推荐(0)
摘要: http://blog.csdn.net/sr_19930829/article/details/39756513http://www.kuangbin.net/archives/hdu4069-dlxhttp://acm.hdu.edu.cn/showproblem.php?pid=3909还是不... 阅读全文
posted @ 2014-11-20 14:20 Jeremy Wu 阅读(176) 评论(0) 推荐(0)
摘要: 这题可以根据l, r 在二进制下的长度进行分类。l 的长度小于 r 的时候,有两种可能,一种是r 在二进制下是 1* 这种样子,故答案取 r ;一种是取答案为 (1LL #include #include #include #include #include #include #include #d... 阅读全文
posted @ 2014-11-19 11:27 Jeremy Wu 阅读(437) 评论(0) 推荐(0)
摘要: 题意:一棵树,给出每个点的权值和每条边的长度,点j到点i的代价为点j的权值乘以连接i和j的边的长度。求点x使得所有点到点x的代价最小,输出虽然还是不太懂树形DP是什么意思,先把代码贴出来把。这道题目的做法是:先进行一次DFS,以每个节点为根,求出它下面节点到它的数量和。再进行一次DFS,以每个节点为... 阅读全文
posted @ 2014-11-11 21:53 Jeremy Wu 阅读(196) 评论(0) 推荐(0)
摘要: 强大的MAP,今天终于开始好好学习一次。map内部是用红黑树维持的有序结构。定义:mapmapStudent;查找的时间复杂度为对数级别.1.构造方法学习两种:第一种:用insert函数插入pair数据,mapStudent.insert(pair(0,"jiangjing"));第二种:用数组方式... 阅读全文
posted @ 2014-11-11 16:40 Jeremy Wu 阅读(215) 评论(0) 推荐(0)
摘要: 一道简单的模拟题需要要匹配{} 和 $$ 符里面的东西即可//#pragma comment(linker, "/STACK:16777216") //for c++ Compiler#include #include #include #include #include #include #inc... 阅读全文
posted @ 2014-11-04 16:42 Jeremy Wu 阅读(160) 评论(0) 推荐(0)
摘要: http://paste.ubuntu.com/8788669/ 阅读全文
posted @ 2014-11-02 21:05 Jeremy Wu 阅读(145) 评论(0) 推荐(0)
摘要: Multiplyand pow Function://计算 (a*b)%c. a,b都是ll的数,直接相乘可能溢出的// a,b,c = c)a %= c; b >>= 1; } return ret;}//计算 x^n %cll pow_mod(ll x,ll n... 阅读全文
posted @ 2014-10-30 13:18 Jeremy Wu 阅读(189) 评论(0) 推荐(0)
摘要: 这是一道蛮基础的构造题。 - k +(k - 1) -(k - 2)1 + k , 1 , k , 2, ................... \ / \ / \ / k k-1 k-2如图所示,先构造第一个... 阅读全文
posted @ 2014-10-27 20:29 Jeremy Wu 阅读(200) 评论(0) 推荐(0)
摘要: 479D - Long Jumps, 480B - Long JumpsIt is easy to see that the answer is always 0, 1 or 2. If we can already measure both x and y, output 0. Then try ... 阅读全文
posted @ 2014-10-26 18:21 Jeremy Wu 阅读(425) 评论(0) 推荐(0)
摘要: 简单DFS 1 //#pragma comment(linker, "/STACK:16777216") //for c++ Compiler 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include ... 阅读全文
posted @ 2014-09-23 14:01 Jeremy Wu 阅读(177) 评论(0) 推荐(0)
摘要: 3A的题目,第一次TLE,是因为一次BFS起点到终点状态太多爆掉了时间。第二次WA,是因为没有枚举蛇的状态。解体思路:因为蛇的数目是小于5只的,那就首先枚举是否杀死每只蛇即可。然后多次BFS,先从起点到第一把钥匙,不能往回走,要用VIS数组标记。第二次从第一把钥匙走到第二把钥匙。最后一次从最后一把钥... 阅读全文
posted @ 2014-09-23 13:58 Jeremy Wu 阅读(289) 评论(0) 推荐(0)
摘要: 这题在比赛的时候WA到写不出来,也有判断ABC子串不一样不过写的很差一直WA在整理清思路后重写一遍3Y解题思路如下:第一种情况:ABABA。 先判断开头的A与结尾的A,得到A的长度,接着判断ABAB 中的AB与AB是否相同(ABAB的长度一定为偶数)已经知道了A长度,AB的长度 接着判断下A 与B是... 阅读全文
posted @ 2014-09-11 11:45 Jeremy Wu 阅读(199) 评论(0) 推荐(0)
摘要: 也是用模板直接套的题目诶//#pragma comment(linker, "/STACK:16777216") //for c++ Compiler#include #include #include #include #include #include #include #include #de... 阅读全文
posted @ 2014-08-27 14:11 Jeremy Wu 阅读(263) 评论(0) 推荐(0)
摘要: 只是套了个模板,模拟退火具体的过程真心不懂阿 1 //#pragma comment(linker, "/STACK:16777216") //for c++ Compiler 2 #include 3 #include 4 #include 5 #include 6 #include 7... 阅读全文
posted @ 2014-08-27 13:06 Jeremy Wu 阅读(381) 评论(0) 推荐(0)
摘要: 来源:http://blog.csdn.net/loveaborn/article/details/29579787网上有人给出这个问题的解决是通过修改文件/etc/fonts/conf.d/49-sansserif.conf倒数第四行为自己喜欢的字体就行了,如我的改为ubuntu网上有人给出这个问... 阅读全文
posted @ 2014-08-22 15:55 Jeremy Wu 阅读(255) 评论(0) 推荐(0)
摘要: 听了ZWK大大的思路,就立马1A了思路是这样的:算最小GPA的时候,首先每个科目分配到69分(不足的话直接输出GPA 2),然后FOR循环下来使REMAIN POINT减少,每个科目的上限加到100即可算最大GPA的时候,首先每个科目分配到60分,然后FOR循环下来使REMAIN POINT减少,每... 阅读全文
posted @ 2014-08-20 20:52 Jeremy Wu 阅读(230) 评论(0) 推荐(0)
摘要: 给出边长,直接就可以求出体积咯关于欧拉四面体公式的推导及证明过程2010-08-16 14:181,建议x,y,z直角坐标系。设A、B、C少拿点的坐标分别为(a1,b1,c1),(a2,b2,c2),(a3,b3,c3),四面体O-ABC的六条棱长分别为l,m,n,p,q,r;2,四面体的体积为,由... 阅读全文
posted @ 2014-08-20 20:20 Jeremy Wu 阅读(258) 评论(0) 推荐(0)
摘要: 好久没写过单组数据的题目了 QAQ赤裸裸的模板题#include #include #include #include #include using namespace std;#define sqr(x) ((x) * (x))const int MAXN = 55;const double EP... 阅读全文
posted @ 2014-08-20 14:38 Jeremy Wu 阅读(184) 评论(0) 推荐(0)
摘要: 这道题得控制好精度,不然会贡献WA QAQ还是那个规则:int sgn(double x){ if(x > eps) return 1; else if(x #include #include #include #include using namespace std;#defin... 阅读全文
posted @ 2014-08-20 11:32 Jeremy Wu 阅读(209) 评论(0) 推荐(0)
摘要: //#pragma comment(linker, "/STACK:16777216") //for c++ Compiler#include #include #include #include #include #include #include #include #define ll long... 阅读全文
posted @ 2014-08-19 11:04 Jeremy Wu 阅读(203) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页