自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(40)
  • 收藏
  • 关注

转载 原位排序专题总结

给定两个array,第一个array为actual number,第二个array为第一个array的每一个元素对应的目标position,求如何根据第二个position将第一个array sort一遍例子:. 1point 3acres 璁哄潧array1 : [5 0 3 2 8...

2015-03-02 19:27:00 278

转载 正整数的基数排序重写

又重写了一遍正整数的基数排序,发现卡住的有以下几个地方: 首先要计算一下数组中最长的数字位数是多少,这一步要记得log函数的自变量为正数,同时,记得log10这个底数不加括号 两层循环,分别是最大数字的位数和枚举10位,每次取出倒数第k位的方法:(num % ( 10^k)) / ...

2015-03-02 19:04:00 195

转载 如何对一个正整数质因数分解?

//对正整数x进行质因数分解,质因数从小到大存在array[]数组中for(inti=2;i*i<=x;++i){if(x%i==0){array[cnt++]=i;while(x%i==0){...

2015-03-02 18:27:00 150

转载 容斥原理,数论,跳蚤

貌似容斥原理在计数中用的还是很多的... 容斥远离的公式还是容易记住的,见下面的wiki链接: http://zh.wikipedia.org/wiki/%E6%8E%92%E5%AE%B9%E5%8E%9F%E7%90%86 问题是,如何将“跳蚤”一题里的叙述对应到题目中呢? ...

2015-03-02 16:52:00 126

转载 poj 1745

#include<iostream>#include<string>#include<cstring>#include<string.h>#include<algorithm>#include<cstdlib>...

2015-03-01 15:51:00 74

转载 poj 3612

//先贴代码:#include<iostream>#include<cstdio>#include<string.h>#include<cstring>#include<string>#include<algorit...

2015-03-01 13:27:00 129

转载 poj 1691

#include<iostream>#include<cstdio>#include<string>#include<cstring>#include<string.h>#include<algorithm>...

2015-02-28 11:45:00 97

转载 最大流 edmonds carp

最大流的问题就不重复了,思路如下: 每次找到一条从s到t的路径,其容量为所经历的所有边上容量最小的一个;将这个路径的容量加入图的总容量;沿着刚才那条路径走,沿两个方向更新边 找路径可以用bfs, 每次bfs 为了保证不重复经过同一个点,可以用visit数组纪录这个点是否被访问过...

2015-02-26 08:37:00 125

转载 poj 1182 并查集

看了网上的思路自己写了一下还是wa了,先放着明天再想~ 转载于:https://my.oschina.net/u/1421373/blog/379965...

2015-02-25 21:47:00 72

转载 并查集union时需要findparent么(持续更新中...)

并查集union时需要findparent么?答案是需要 转载于:https://my.oschina.net/u/1421373/blog/379957...

2015-02-25 20:55:00 87

转载 cf 359 B

先贴代码: #include<cstdio>usingnamespacestd;intmain(){intn,k;while(scanf("%d%d",&n,&k)==2){printf("1...

2015-02-25 08:47:00 120

转载 cf 484A

#include<iostream>#include<cstdio>#include<string>#include<string.h>#include<cstring>#include<algorithm>usingn...

2015-02-25 08:21:00 56

转载 poj 1015

#include<iostream>#include<cstdio>#include<string.h>#include<cstring>#include<string>#include<algorithm>#...

2015-02-24 23:13:00 65

转载 [转]一次有趣的Google面试经历

本文转自毕业生论坛 原文链接如下:http://bbs.yingjiesheng.com/thread-895281-1-1.html 很多年前我进入硅谷人才市场,当时是想找一份高级工程师的职位。如果你有一段时间没有面试过,根据经验,有个非常有用的提醒你应该接受,就是:你往往会在前几次面...

2015-02-23 20:27:00 78

转载 数组传参

参考: http://blog.csdn.net/jackystudio/article/details/12137477 二维数组传参总结: http://blog.csdn.net/gqb_driver/article/details/8886687 ...

2015-02-23 20:17:00 60

转载 poj 1274

#include<iostream>#include<cstdio>#include<string.h>#include<string>#include<cstring>#include<algorithm>...

2015-02-23 17:44:00 48

转载 概念(持续更新中...)

树和DAG(Directed Acyclic Graph)的区别Trees are a subset of DAG, under the restriction that each tree node has only one parent. ...

2015-02-23 17:19:00 64

转载 poj 3041

#include<iostream>#include<cstdio>#include<string>#include<cstring>#include<string.h>#include<algorithm>...

2015-02-23 16:56:00 53

转载 Leetcode Jump Game

classSolution{ public: boolcanJump(intA[],intn){ intll=0,rr=0; while(ll<=rr){ intf=ll+A[ll]; if(f>=n-1...

2015-02-23 14:52:00 103

转载 interview recall

给一个unsortedpositive integer array , 没有duplicate, 输出是一个integer 和 这个integer 后面第一个大于该integer的那个数,这道题可以用stack来做, 代码如下: #include<iostream>#in...

2015-02-23 12:25:00 84

转载 Codeforces 494A

#include<iostream>#include<cstdio>#include<string>#include<cstring>#include<string.h>#include<algorithm>#...

2015-02-23 11:44:00 108

转载 poj 1330

先贴代码: #include<iostream>#include<cstdio>#include<vector>#include<string>#include<string.h>#include<cstring&g...

2015-02-23 09:45:00 56

转载 poj 3368

#include<iostream>#include<cstdio>#include<string>#include<string.h>#include<cstring>#include<algorithm>#...

2015-02-22 17:09:00 56

转载 Codeforces 494B

#include<iostream>#include<string>#include<cstring>#include<string.h>#include<algorithm>#include<cstdlib>...

2015-02-22 10:16:00 93

转载 latex wrap text in tables

//Usep{width}foryourcolumnspecifiersinsteadofl/r/c.\begin{tabular}{|p{1cm}|p{3cm}|}Thistextwillbewrapped&Somemoretext\\\e...

2015-02-21 22:53:00 136

转载 Codeforces 492 B

用二分法找到符合条件的最值 开始时用的绝对精度判断解的正确性,在大的test case上会tle, 后来用了相对精度,ac了 #include<iostream>#include<stdio.h>#include<string.h>#include&l...

2015-02-21 18:42:00 94

转载 Codeforces 492A

#include<iostream>#include<cmath>#include<cstdlib>#include<algorithm>#include<string>#include<string.h>#i...

2015-02-21 17:01:00 153

转载 Codeforces 6C

#include<iostream>#include<cstdio>#include<string>#include<string.h>#include<cstring>#include<algorithm>...

2015-02-21 13:44:00 76

转载 Codeforces 5C

#include<iostream>#include<cstdio>#include<string.h>#include<string>#include<cstring>#include<algorithm>#...

2015-02-21 00:31:00 64

转载 Codeforces 5B

#include<iostream>#include<string.h>#include<cstring>#include<string>#include<algorithm>#include<cstdlib>...

2015-02-20 22:11:00 93

转载 Codeforces 5A

#include<iostream>#include<cstdio>#include<string.h>#include<cstring>#include<string>#include<algorithm>#...

2015-02-20 21:38:00 55

转载 Codeforces 4D

#include<iostream>#include<cstdio>#include<string.h>#include<cstring>#include<string>#include<algorithm>#...

2015-02-20 19:47:00 92

转载 Codeforces 4B

#include<iostream>#include<cstdio>#include<string>#include<string.h>#include<cstring>#include<algorithm>...

2015-02-14 22:27:00 117

转载 Codeforces 4A

给一个数字(1 ~ 100 之间),问这个数字是否能分成两个正偶数的和 代码: #include<iostream>#include<cstdio>usingnamespacestd;intmain(){ intn; while(cin&gt...

2015-02-14 21:48:00 55

转载 Codeforces 3B

题意:用一个truck运两种船,一种占空间1m^3(type 1), 一种占空间2m^3(type 2), 给定truck的容量v(以m^3计)和一个船运载量的list,求出truck所运船的最大运载量和达到最大运载量时运载的船集合(有多个可选的集合时print任意一个集合) 分析:读完了题...

2015-02-14 15:20:00 83

转载 Codeforces 3A

题意描述: 8*8的棋盘里给出起点和目标,找到两点之间的最近距离并打印路径;从一个点可以向8个方向走; 这道题wa了一遍,对了一下错误数据才看到错在了哪里, 找到目标后向起点回溯的条件是:tmpx != startx || tmpy != starty而不是 && 另外...

2015-02-13 15:02:00 95

转载 Codeforces 1A

这道题需要注意的地方就是输入变量的取值范围,由于n, m ,a 都是 1 ~ 10^9之间的数字,所以变量要用unsigned long long ; 开始的两次用了int 和unsigned long ,在test 16都wrong answer 了,第三遍修改成unsigned long...

2015-02-12 09:07:00 85

转载 Java HashSet<Integer>与Java HashSet<int> 的区别

写代码时需要用到Map,而C++的Map又是用BST来实现的,效率比较低,所以转用Java 但是在HashSet中,Key是int时,编译无法通过,报错信息类似于: 错误:意外的类型 需要:引用 找到: int 在网上找了一些资料后发现,HashSet<int>的用法是不...

2015-02-05 16:40:00 656

转载 C++ hash_map

希望了解hash_map和map的用法及特点 转载于:https://my.oschina.net/u/1421373/blog/375594...

2015-02-05 11:08:00 60

转载 Codeforces 242B

#include<stdio.h>#include<cstring>#include<string.h>#include<vector>usingnamespacestd;intmain(){ intn; intstart...

2015-02-05 10:11:00 61

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除