随笔分类 -  ACM

摘要:之前做过两年的运维,用过很多命令,深切体会到某些linux命令熟练掌握后对效率提升有多大。举个简单的例子,在做了研发后经常会有跑一些数据,对于结果数据的处理,我们的产品同学一般都习惯于用excel做统计,把数据复制到excel里,然后数据分列,排序………… 最后得出某些简单的结论,我只需要cat, 阅读全文
posted @ 2019-08-29 20:58 xindoo 阅读(629) 评论(0) 推荐(0)
摘要:温馨提示:本文中Alfred是Mac平台的工具,不适用于其他平台。 "Alfred" 是Mac平台上被很多人吹爆的一款效率提升软件,我刚毕业工作的时候就看到公司内网有人推荐,但没有尝试。 后来我跳槽后自己买了Macbook pro,在努力把笔记本打造成高效开发工具时,又重新发现了这个app,又毫不犹 阅读全文
posted @ 2019-08-19 22:08 xindoo 阅读(12279) 评论(0) 推荐(2)
摘要:学过计算机底层原理、了解过很多架构设计或者是做过优化的同学,应该很熟悉局部性原理。即便是非计算机行业的人,在做各种调优、提效时也不得不考虑到局部性,只不过他们不常用局部性一词。如果抽象程度再高一些,甚至可以说地球、生命、万事万物都是局部性的产物,因为这些都是宇宙中熵分布布局、局部的熵低导致的,如果宇 阅读全文
posted @ 2019-08-05 16:40 xindoo 阅读(6687) 评论(2) 推荐(6)
摘要:题目链接题意: 给你一个字符串,在字符串尾部加上一些字符,使这个字符串变成一个回文串(正反读都一样的字符串),求该回文串的最小长度。思路: 在light oj里这个题目是属于KMP分类的,但乍看好像不是kmp,因为只有一个字符串。要想的到一个回文串,把该字符串翻转接到原串后面必然是一个回文串,但并不一定是最短的。我们必须考虑怎么把两个串尽量融合在一起,这就要看翻转串的前段与原串的后段有多少是匹配的了,这里就用到了KMP算法。代码://2013-05-13-20.01#include #include const int maxn = 1000005;char a[maxn];char b[.. 阅读全文
posted @ 2013-05-13 20:10 xindoo 阅读(125) 评论(0) 推荐(0)
摘要:题目链接The people of Mohammadpur have decided to paint each of their houses red, green, or blue. They've also decided that no two neighboring houses will be painted the same color. The neighbors of housei are houses i-1 and i+1. The first and last houses are not neighbors.You will be given the info 阅读全文
posted @ 2013-04-22 08:27 xindoo 阅读(191) 评论(0) 推荐(0)
摘要:题目链接A.Snow FootprintsA - Snow FootprintsThe starting position can be anywhere with a footprint. The footprints can be categorized into 3 types.onlyLsonlyRsRs followed byLsIn case 1, we end in the left of all footprints. In case 2, we end in the right of all footprints. In case 3, we either end in th 阅读全文
posted @ 2013-04-19 22:20 xindoo 阅读(154) 评论(0) 推荐(0)
摘要:题目链接题意: 有一字符串只包含0和1,然后又m组操作,I L R是将从L到R的字符进行翻转操作0变为1、1变为0,Q x表示询问第x的字符。思路: 我们只需要计算对询问的字符进行了多少次翻转,如果是偶数次,该字符变,否则翻转。对于区间的更新,我们可以使用线段树,不过对于这个题,因为只是对点的查询,而且每个节点的初始值都相同,为0,因此我们可以直接使用树状数组。下面是一个很巧妙的做法,而且很容易理解。用了树状数组的区间更新 单点查找(一般为单点更新 区间查找)例如 区间(2,4)加1则Updata(2,1) Updata(4+1,-1)实现了更新(2,4)的值而不改变其他值求Sum时即可得.. 阅读全文
posted @ 2013-04-12 18:58 xindoo 阅读(195) 评论(0) 推荐(0)
摘要:A. Shaass and Oskols题意:在n条电线上有不同数量的鸟, Shaass开了m枪,每一枪打的是第xi条电线上的第yi只鸟,然后被打中的这只鸟左边的飞到第i-1条电线上,右边的飞到i+1条电线上,没有落脚点的鸟会飞走。#include int a[105];int main(){ int n, m, x, y; while (scanf("%d",&n) != EOF) { for (int i = 1; i #include int w[105],t[105],n; int mem[105][205][205]; int m... 阅读全文
posted @ 2013-04-08 07:20 xindoo 阅读(156) 评论(0) 推荐(0)
摘要:题目链接DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to the right of the given star. Astronomers want to know the distribution of the 阅读全文
posted @ 2013-04-06 10:10 xindoo 阅读(128) 评论(0) 推荐(0)
摘要:题目链接DescriptionN (2 #include #include #define maxn 8005using namespace std;int a[maxn];int ans[maxn];int n;int lowbit(int x){ return x&(-x);}void add(int x, int v){ while (x 0) { s += a[x]; x -= lowbit(x); } return s;}int binarysearch(int l, int r, int x){ if (l == r... 阅读全文
posted @ 2013-04-06 09:57 xindoo 阅读(167) 评论(0) 推荐(0)
摘要:题目链接 DescriptionAn entropy encoder is a data encoding method that achieves lossless data compression by encoding a message with "wasted" or "extra" information removed. In other words, entropy encoding removes information that was not necessary in the first place to accurately en 阅读全文
posted @ 2013-04-05 15:56 xindoo 阅读(192) 评论(0) 推荐(0)
摘要:由于英语极差,看了半天也没看懂题目,最后参考了其他人的题解才搞懂题目,我就直接把题意贴过来了 题意:这道题目只是题意自己就去理解了半天,大概题意如下:给出i一个n*n的矩阵,初始化为均为0,还有关于这个矩阵的几种操作,操作如下:命令1:(X Y A)对位于坐标(X Y)的值加A;命令2:(L B R T)求出位于L#include const int maxn = 1030;int n, a[maxn][maxn];int lowbit(int x){ return x & (-x);}void update(int i, int j, int v){ int t; w... 阅读全文
posted @ 2013-04-05 10:55 xindoo 阅读(141) 评论(0) 推荐(0)
摘要:无疑是STL 中最大的一个头文件,它是由一大堆模板函数组成的。下面列举出中的模板函数:adjacent_find / binary_search / copy / copy_backward / count/ count_if / equal / equal_range / fill / fill_n / find /find_end / find_first_of / find_if / for_each / generate /generate_n / includes / inplace_merge / iter_swap /lexicographical_compare / lower 阅读全文
posted @ 2013-04-04 20:27 xindoo 阅读(197) 评论(0) 推荐(0)
摘要:全排列函数next_permutationSTL中专门用于排列的函数(可以处理存在重复数据集的排列问题)头文件:#includeusingnamespacestd;调用:next_permutation(start,end);注意:函数要求输入的是一个升序排列的序列的头指针和尾指针.用法:// 数组int a[N];sort(a, a+N);next_permutation(a, a+N);// 向量vector ivec;sort(ivec.begin(), ivec.end());next_permutation(ivec.begin(), ivec.end());例子:vector my 阅读全文
posted @ 2013-04-04 08:18 xindoo 阅读(276) 评论(0) 推荐(0)