- 博客(99)
- 资源 (4)
- 收藏
- 关注
原创 linux个人常用命令总结
所有命令参数情况可以输入:命令--help 查看这里只记录我用的一些命令及参数,以后用的新的也会进行补充。 df显示各磁盘块的占用情况,总空间,占用空间,占用比例,剩余空间等 du查看目录及其所有子目录所占磁盘空间du (+参数) +(目录)常用参数:-a 显示包括目录及文件(writecounts for all files, not just direc
2013-10-19 21:22:12
980
转载 阿里校招内推简历筛选的阶段性小结(转)
上周发了一个阿里内推的帖子,没想到短时间内就收到了成百上千封简历。 我仔仔细细地看了每一封简历,附带有Github地址的我也点进去仔细看了代码。 最终我留下了30%的简历,而且这30%中只有10%的本科生。 所有通过内推初步筛选的小伙伴会在8月30号收到邮件通知。 筛选标准 满足以下条件中的任何一个,直接通过筛选: * ACM, Topco
2013-09-09 20:01:54
1845
转载 机器学习中的算法-支持向量机(SVM)基础
转载自 http://www.cnblogs.com/LeftNotEasy/archive/2011/05/02/basic-of-svm.html一、线性分类器: 首先给出一个非常非常简单的分类问题(线性可分),我们要用一条直线,将下图中黑色的点和白色的点分开,很显然,图上的这条直线就是我们要求的直线之一(可以有无数条这样的直线) 假如说,我们令黑色的点 =
2013-08-14 20:18:56
886
原创 Codeforces Round #146 (Div. 2) D. Let's Play Osu! comb数平方和的数学期望
题目:D. Let's Play Osu!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou're playing a game called Osu! Here's a simplified ver
2012-10-21 17:13:57
2286
4
原创 hdu 3351 Seinfeld / poj 3991 括号匹配2
题意:给出一个由'{' , '}' 组成的字符串,通过改变最少括号的方向使其匹配。思路:一开始用区间dp,TLE了,贪心才能过。贪心方法:从左向右遍历,遇到左括号lef++,遇到右括号,若lef>0,lef--,否则右括号变为左括号,ans++,lef++,最后再加上多下来的左括号,即lef/2。 先给出TLE代码:#include#include#include#inclu
2012-10-21 12:22:59
1390
原创 poj 1141 Brackets Sequence 括号匹配
题意:给出一个由'(' , ')' ,'[' , ']' 组成的字符串,通过增加最少括号使其匹配。解法:区间dp,记录下划分位置。PS:用while(scanf!=EOF)会WA #include#include#include#include#includeusing namespace std;const int maxn=105;char str[maxn];in
2012-10-21 12:16:52
595
原创 poj 2411 Mondriaan's Dream / hdu 1400
题意:用1*2的矩形拼成h*w的矩形,有多少种拼法?(h,w解法:状态压缩DP #include#include#include#include#includeusing namespace std;long long dp[2][2500], ans[15][15];int p2[15];int check(int x){ while(x){
2012-10-06 20:26:12
1137
原创 poj 1082 / hdu 1079 Calendar Game
题意:从一个日期开始,轮流改变时间,可以变为下一天或者是同一年的下一个月的当天。先到2001年11月4日的获胜。基础博弈问题任意能到达必败状态的位置为必胜状态,倒着递推一下。 #include#include#include#include#include#includeusing namespace std;int dp[120][15][35];struct n
2012-10-05 15:36:50
664
转载 大型网站系统架构分析
原文出处:http://www.cnblogs.com/Mainz/archive/2009/04/28/1445424.html千万级的注册用户,千万级的帖子,nTB级的附件,还有巨大的日访问量,大型网站采用什么系统架构保证性能和稳定性? 首先讨论一下大型网站需要注意和考虑的问题。 数据库海量数据处理:负载量不大的情况下select、delete和update是响应很迅速的,
2012-10-03 16:25:19
824
原创 poj 3021 A Number from Yanghui Triangle
推出公式来就是水题。S(n,k) = C(n,0)+10^k*C(n,1)+10^2k*C(n,2)+.... ...+10^nk*C(n,n) 10^k*S(n,k) = 10^k*C(n,0)+10^2k*C(n,1)+10^3k*C(n,2)+.... ...+10^(n+1)k*C(n,n)两式求和可得 S(n, k) + 10^k*S(n, k) = S(n+1, k)
2012-10-02 19:45:47
743
原创 谷歌面试经历
与谷歌的缘分是始于半年前的Codejam,当时做它只是为了T-shirt,最终倒在online 2-round(前1000有T-shirt,我1500左右)。 八月下旬接到谷歌中国的HR打来的电话,邀请我投简历。 1st Phone Interview - Google 9月27日 17:00 p.m.先是简短自我介绍。然后两道题目结束。(面试时需要在online do
2012-10-02 15:25:51
4708
原创 poj 2923 Relocation 状态压缩
题意:给你n件货物的重量(n思路:货物数量很少,二进制记录状态,用背包预处理能一次运完的状态,再从初始全1状态开始bfs,到达全0状态结束。 #include#include#include#include#include#includeusing namespace std;int n, c1, c2, cas=1;int p2[12], c[12], flag[15
2012-10-02 15:16:56
640
原创 hdu 4410 Boomerang (2012杭州网络赛1001)
这题简直是个大坑,比赛时做了两个多小时,写了两百多行代码,各种调,就是没做出来。。。比完赛晚上十点多开始重写,写到半夜一点,终于过了!!! 思路:枚举所有情况,n=4一种,n=6一种,n=8四种。 先给组数据8 -3 9 0 9 0 0 9 0 9 -2 1 -2 1 -1 -3 -18 -3 9 0 9 0 0 9 0 9 -4 1 -4 1 -1 -3 -18 3
2012-09-24 01:11:09
2372
原创 hdu 4404 Worms (2012金华网络赛E题)
多边形与圆的相交面积,把多边形分解成三角形处理,模版题。特殊注意:正余弦反三角函数里的参数为+1、-1的时候会出错,把它们都乘上(1-EP)就可以了。 #include#include#include#includeusing namespace std;const double Pi=acos(-1.0);const double EP=1e-10;struct Poi
2012-09-22 17:07:14
3237
原创 百度面试经历及总结
百度公司一直是我向往的,大三暑假,开始准备简历,然后让在百度的学长给内推。内推的是网页搜索部,内推后大概过了半个月才通知我。(内推的最大好处就是不用笔试) 那天是8月23号下午4点左右,当时正好在做多校联合。ST-招聘助理姐姐打电话来,通知我第二天上午10点半电话面试。感觉通知的有点晚了啊,我都来不及准备什么,稍微看了看数据结构就坐等面试了。 8月24号10:3
2012-09-19 22:52:08
3448
3
原创 hdu 4293 Groups
dp,dp[i][j]为前j个人中,i+1到j为一组时,说真话的最大人数。注意预判同一组人数个数是否超出组内人数上限。 #include #include #include #include #include #include #include #include using namespace std;int n, ans;int a[505][505], dp[505
2012-09-16 17:52:23
2377
原创 poj 3449 Geometric Shapes
求各种图形的相交问题,简化到求线段相交问题。WA了一次,原因是叉积相乘超出了int范围,以后要注意! #include#include#include#include#includeusing namespace std;char str[30][3], ans[30];int n;struct Point{ int x, y; Point operat
2012-09-13 14:54:20
546
原创 poj 1556 The Doors
计算几何+最短路通过线段是否完全相交判断两点的连通性。 #include#include#include#includeusing namespace std;const double inf=1e10;const double EP=1e-8;struct Point{ double x, y;}p[105]; //4*n+2stru
2012-09-06 15:26:49
419
原创 C++ 堆 为了面试蛋疼的写了下C++熟悉下
#include#include#include#include#include#includeusing namespace std;const int maxn = 1000005;struct node{ int id, x; friend bool operator < (node p1, node p2){ return p1.x<p2.
2012-08-27 16:49:33
455
原创 poj 1471 Triangles
dp,注意三角形朝向问题,每个位置的三角形只能朝一个特定的方向延伸。 #include#include#include#include#includeusing namespace std;const int maxn=105;int n, cas=1, empty[maxn][2*maxn]; //i行 j之前连续“-”数(包括j)char str[ma
2012-08-22 13:07:02
813
原创 poj 1947 Rebuilding Roads 树形dp加背包
dp[i][j]记录以i为根的树保留j个结点的费用。状态转移方程:dp[i][j]=min(dp[i][j], dp[i][j-k]+dp[s][k]-2) ,s为i的子结点,减2是i到s这条边分别在dp[i][j-k]和dp[s][k]中多删去了一次。 #include #include #include #include using namespace std;const
2012-08-20 11:19:34
429
原创 hdu 4341 Gold miner 分组背包
简单分组背包,同一斜率为一组。 #include #include #include #include #include using namespace std;double EP=1e-8;int n, T, vis[205], sum[205], cnt, dp[40005];struct node{ int x, y, t, v;}p[205];struc
2012-08-19 19:57:08
439
原创 poj 1655 Balancing Act
简单树形dp状态转移方程: ans[i] = max(dp[j], n-dp[i]) j为i的所有子节点,dp[i]为以i为根的子树结点个数。 #include #include #include #include #include #define min(a,b) ((a)>(b)?(a):(b))using namespace std;const int maxn=
2012-08-19 15:16:02
407
原创 hdu 4368 Water World I
多校联合第七场的题,开始后50分钟第二个ac。简单的计算几何,思路比较明确,求出倾斜后的坐标,扫描一遍所有点,去掉那些水下的点,求一次面积,减去原来面积就行了。复杂度O(n)#include #include #include #include #include using namespace std;const double Pi=acos(-1.0);const doub
2012-08-14 19:33:51
782
原创 hdu 1394 Minimum Inversion Number 线段树求最小逆序数
可以不断将尾部移动到头部,求最小逆序数。 #include#include#include#include#includeusing namespace std;const int maxn=5005;int n, a[maxn];struct node{ int lef, rig, mid, cover;}seg[maxn*4];void make_tree
2012-08-11 22:04:38
479
原创 poj 1177 / hdu 1828 Picture 矩形周长并
分x边和y边两次线段树扫描线,寻找cover值0->1的区域,长度*2即可。#include #include #include #include #include using namespace std;const int maxn=20005;const int TT=10000;int n;struct rect{ int x1, y1, x2, y2;}re
2012-08-11 14:06:12
552
原创 hdu 1255 覆盖的面积 矩形D层以上重叠面积
矩形面积并,求D层以上重叠的面积离散化后扫描线 4000ms低效率水过 #include#include#include#include#includeusing namespace std;const double EP=1e-8;const int maxn=2005;const int D=2;int n, cas=1;double hash[maxn];s
2012-08-10 22:45:56
1034
原创 poj 1151 Atlantis / hdu 1542 线段树扫描线 矩形面积并
#include#include#include#include#includeusing namespace std;const double EP=1e-8;const int maxn=205;int n, cas=1;double hash[maxn];struct nod{ double x; int c, id;}a[maxn];struct
2012-08-10 21:26:51
538
原创 poj 1143 Number Game
博弈思想,状态压缩后记忆化搜索,必胜状态的条件为自状态存在必败状态。g++ 0ms ac c++wa 知道原因的留个言 #include#include#include#include#includeusing namespace std;int vis[600005], a[25], p2[25], cnt, ans[25];//一共2^19种状态,19位2进制记
2012-08-10 14:39:14
660
原创 hdu 4344 Mark the Rope
2^64内大整数分解质因子,比之前的模版快#include #include #include #include #include using namespace std;typedef long long LL;using namespace std;const int prime[]={0,2,3,5,7,11,13,17,19,23};LL gcd(LL x, LL
2012-08-09 20:51:30
679
原创 hdu 4355 Party All the Time
//模版题,三分法#include #include #include #include #include using namespace std;const double EPS=1e-8;struct node{ double x, w;}p[50005];int n;double Calc(double t){ double ret=0; for(
2012-08-09 20:47:12
401
原创 poj 2429 GCD & LCM Inverse
题意:给出两数的gcd和lcm,求乘积最小的两数。解法:枚举lcm/gcd的因子,套模版。 #include#include#include#include#include#define time 12using namespace std;int p2[20];const int C=200;const long long max1 = (long long)pow
2012-08-06 15:15:26
526
原创 poj 1811 Prime Test
题意:大整数判断素数,非素则求最小质因子。Pollard-Rho和Miller-Rabin各种纠结,自己的模版各种TLE,只好去copy别人的。Orz#include#include#include#include#include#define time 12using namespace std;const long long max1 = (long long)pow(
2012-08-06 12:02:20
395
原创 poj 3026 Borg Maze
思路:转化为求S和所有A点的最小生成树。通过对每个A点和S点bfs建图,然后prim求MST。 #include #include #include #include using namespace std;int move[4][2]={1,0,-1,0,0,1,0,-1};int n, m, cnt, flag[55][55], vis[55][55], a[105][10
2012-07-23 18:01:29
399
原创 poj 2917 Diophantus of Alexandria
题意:1/x+1/y=1/n 给出n,求x、y的解数,x、y、n均为正整数。解法:1/x+1/y=1/n --> nx+ny=xy --> (n-x)*(n-y)=n*n 转化为求n*n小等于n的因子的个数,由于n达到10^9,直接求太大。将n分解质因子,复杂度为logn,n*n对应的质因子和n相同,且个数翻倍,即可得到n*n的质因子个数。 #include#includ
2012-07-20 16:04:42
616
原创 hdu 4308 Saving Princess claire_ (多校联合1)
//bfs或者最短路 #include#include#include#include#includeusing namespace std;int move[4][2]={1,0,-1,0,0,1,0,-1};int r, c, cost, num_p, flag, ans;char maze[5005][5005];bool visited[5005][5005];
2012-07-20 09:39:59
662
原创 hdu 4301 Divide Chocolate (多校联合1)
//题意:将2*n的长方形划分为k块,有多少种方法。最小单位为1*1的小矩形,且每块都不同。//解法:递推,状态转移种类比较多,需要考虑全面。 #include#include#include#includeusing namespace std;const long long M=100000007;long long n, k;long long dp[1005][2
2012-07-20 09:37:23
1008
原创 poj 2926 Requirements N维最远曼哈顿距离
以前写过1~3维的最远曼哈顿距离,(本博客第一篇,代码奇丑)这次写N维,可作模版。复杂度:O(n*2^m) (n个点,m维)原理: |x1-y1|+|x2-y2|+... ...+|xm-ym| 去掉绝对值后x、y分别都有2^m种状态,枚举之。#include #include #include #include #include using namespace std;
2012-05-16 22:22:10
3918
原创 山东省第三届省赛D题
比赛的时候看错题目,它是个伪扫雷,数字只代表周五5个位置的雷数。题意:输入扫雷大小n,m,n*m数字矩阵,输出雷的分布(只有唯一解)解法:简单搜索#include #include #include #include #include using namespace std;int n,m,flag;int move[5][2]={0,0,0,1,0,-1,1,0,-1,
2012-05-16 21:16:43
2328
原创 省赛总结
这一年虽然也有打酱油,但是自我感觉还是进步了很多,所以这次省赛本是抱着很大目标去的,导致从去之前两天到比赛,一直保持着一种亢奋状态。第一天热身赛,更是相当亢奋,比赛前,我就和队友说,我们要First Blood! 本来分配的是我读A题,悦悦读B题,包子读C题,当我瞄到B题的标题是有“Prime”字样时(我对素数题比较感兴趣),我就立马和悦悦说,我读B,你来读A,然后我两眼看完后就确定是素数筛后暴力
2012-05-14 13:14:18
2724
2
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人