- 博客(64)
- 资源 (1)
- 收藏
- 关注
原创 第一个hadoop程序(JAVA)
准备环节安装如下应用1.Hadoop2.7.72.Jdk1.8.03.IDEA2019.1上篇写过前两个的安装这里简单说一下idea安装运行http://www.jetbrains.com/idea/download/#section=windows下载安装包解压然后在bin目录下运行idea.sh即可嫌麻烦可以建一个快捷方式创建项目SDK...
2019-07-16 16:23:57
476
原创 Ubuntu Hadoop(伪分布式)安装
最近生产实习在做大数据方面的,记录一下安装包准备图是我在机房电脑上装时截的图,安装包是机房提供的我自己装的是下面两个(附链接),安装步骤没有变化hadoop-2.7.7.tar.gzjdk-8u211-linux-x64.tar.gz一 SSH免密设置命令:ssh-keygen密钥存储路径,回车默认即可出现overwrite说明设置过,y即可然后密码和确认...
2019-07-16 16:01:41
321
原创 ACM-ICPC 2018 南京赛区网络预赛 E AC Challenge
题目链接:https://nanti.jisuanke.com/t/30994题意:有n道题,做第i道题首先得做Si道题(p1,p2,...,psi),做一道题需要一分钟,在t时刻完成第i道题可以获得t×ai+bi分数求最大值思路:首先看数据就暗示了状压,1 << i表示第i道题,于是可以连一条 到i的有向边,然后记忆化搜索就好#include<b...
2018-09-05 20:24:59
328
原创 Splay Tree(模板)
题目:https://www.luogu.org/problemnew/show/P3369 #include<bits/stdc++.h>//#define DEBUGusing namespace std;const int inf = 2e9 + 50;class node{public: node* ch[2], *fa; ...
2018-09-05 20:10:02
262
转载 gcc的__builtin_函数介绍
GCC提供了一系列的builtin函数,可以实现一些简单快捷的功能来方便程序编写,另外,很多builtin函数可用来优化编译结果。这些函数以“__builtin_”作为函数名前缀。很多C标准库函数都有与之对应的GCC builtin函数,例如strcpy()有对应的__builtin_strcpy()内建函数。下面就介绍一些builtin函数及其作用: __builtin_ffs(x):...
2018-08-07 22:01:16
1046
原创 POJ 3635(HDU 1676)Full Tank?
题目:http://poj.org/problem?id=3635用优先级队列+dijkstra//#include<bits/stdc++.h>//#define DEBUG#include<cstdio>#include<iostream>#include<cstring>#include<string>#inc...
2018-08-07 18:35:59
248
原创 Uva 1330 City Game
https://vjudge.net/problem/UVA-1330悬线法#include<bits/stdc++.h>using namespace std;const int maxn = 1e3 + 50;const int inf = 1e9 + 7;int n, m, k;char M[maxn][maxn];int up[maxn][maxn],...
2018-07-30 00:19:30
250
原创 2017 ICPC Naning Rake It In
题目链接alpha-beta剪枝#include<cstdio>#include<iostream>#include<cstring>#include<string>#include<queue>#include<map>#include<vector>#include<set
2018-07-29 01:04:42
352
原创 2-SAT
2-SAT一切尽在链接中模型一:两者(A,B)不能同时取 那么选择了A就只能选择B’,选择了B就只能选择A’ 连边A→B’,B→A’ 模型二:两者(A,B)不能同时不取 那么选择了A’就只能选择B,选择了B’就只能选择A 连边A’→B,B’→A 模型三:两者(A,B)要么都取,要么都不取 那么选择了A,就只能选择B,选择了B就只能选择A,选择了A’就只...
2018-07-27 19:35:55
1074
转载 C++ flush, cin.tie以及sync_with_stdio
转自:https://blog.youkuaiyun.com/u010620604/article/details/50803163flush()ostream类的一个方法,作用是将缓冲区的数据刷新到输出文件。codeforces有和测评机交互的题目interactive problem,c++要求的就是用flush()#include <ostream> /* std...
2018-07-26 02:23:51
588
转载 数学与算法的艺术
为了更好体现数学在计算机算法中的重要作用,我来介绍一些数学知识以及它们的应用。转自:https://blog.youkuaiyun.com/acdreamersContens 1. 秦九韶算法 9. 最小二乘法 2. 斯特林公式 10. 自守数 3. 外观数列 4. 整数拆分问题 ...
2018-07-23 23:27:25
2326
原创 LCA(倍增,RMQ,Tarjan)
LCA(Least Common Ancestors):最近公共祖先题目:https://www.luogu.org/problemnew/show/P3379倍增先预处理出每个结点向上跳2^x层的祖先和每个结点的深度类似快速幂,拆分deep[u] - deep[v](假设deep[u] > deep[v]),每次使u向上跳2^x步,使deep[u] = deep[v]然...
2018-07-21 14:11:49
488
原创 关于欧拉函数
欧拉函数: 对于正整数 n , 欧拉函数是小于等于 n 的数中与 n 互质的数的个数性质1:p为素数则有1~p-1都和p互素性质2:对于互素的q, p,则有积性函数性质3:p为素数,则 只有一个素因子p,所以素因子中有p的数都不和 互素,所以1~ - 1不和互素的有所以1~-1中和互素的有 对于某个数 n运用性质2,3化简 每个括号提出ai的pi...
2018-07-20 22:25:19
304
原创 Havel-Hakimi定理
Havel-Hakimi定理:给定一个非负整数序列{d1,d2,...dn},若存在一个无向图使得图中各点的度与此序列一一对应,则称此序列可图化。进一步,若图为简单图,则称此序列可简单图化。题目:http://poj.org/problem?id=1659#include<cstdio>#include<iostream>#include<cstring>...
2018-07-08 23:19:49
428
原创 POJ 2762 Going from u to v or from v to u?
题目链接:http://poj.org/problem?id=2762缩点后判断出度或者入度为0的点的个数#include<cstdio>#include<iostream>#include<cstring>#include<queue>#include<map>#include<vector>#include&l...
2018-07-08 23:16:03
267
原创 点/边双联通分量
点联通分量:求割点时已经遍历完一个联通分量,弹栈至改割点即可题目链接:http://poj.org/problem?id=1523#include<cstdio>#include<iostream>#include<cstring>#include<queue>#include<map>#include<vector>...
2018-07-05 18:20:45
337
原创 割点 桥
割点(割顶):一个结点称为割点(或者割顶)当且仅当去掉该节点极其相关的边之后的子图不连通。模板题:https://www.luogu.org/problemnew/show/P3388#include<bits/stdc++.h>using namespace std;const int maxn = 3e5 + 5;int n, m, inde;vector<in...
2018-07-03 02:31:28
215
原创 简单莫队
题目:小Z的袜子莫队:当年国家队队长莫涛大犇发明的算法orz一开始T到怀疑人生最后发现用重载小于号的排序就gg,改成两个函数就ok了!!,暂时不知道为什么orz#include<bits/stdc++.h>using namespace std;const int maxn = 50010;const int64_t mod = 1e9 + 7;int n, m;int...
2018-06-29 01:48:23
335
原创 分解强连通分量
模板题目:http://poj.org/problem?id=2553Kosaraju:按顺序对原图和反图DFS一遍,在第二次DFS时点u可达未DFS的点v则u,v属于同一个联通分量#include<cstdio>#include<iostream>#include<cstring>#include<queue>#include&l...
2018-06-28 21:56:31
305
原创 二分图带权匹配(KM算法)
模板题一一切尽在代码中#include<bits/stdc++.h>using namespace std;const int maxn = 55;const int inf = 1 << 30;const int64_t mod = 1e9 + 7;int w[maxn][maxn];int lx[maxn], ly[maxn];int lin...
2018-06-24 23:26:07
336
原创 hdu 3461 Code Lock
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3461题意:题意很难懂
2018-06-02 20:52:09
292
原创 次短路条数 poj3463 Sightseeing
题目链接:poj3463(别人的代码)#include <stdio.h>#include <cstring>#define INF 0x7fffffffusing namespace std;struct edge{ int y,w,next;}e[10001];int ls[10001],cnt[1001][2],dis[1001][2],n,m,...
2018-05-14 18:27:31
193
原创 最小树形图
模板题:poj3164定义:一个有向图,存在从某个点开始的到达所有的的一个最小生成树,则它就是最小树形图。朱-刘算法的大概过程如下:1、找到除了root以为其他点的权值最小的入边。用In[i]记录2、如果出现除了root以外存在其他孤立的点,则不存在最小树形图。3、找到图中所有的环,并对环进行缩点,重新编号。4、更新其他点到环上的点的距离 假设有重新编号之...
2018-05-14 16:12:10
242
原创 CodeForces 967C Stairs and Elevators
题目链接:http://codeforces.com/problemset/problem/967/C思路:1:同一层直接abs(y1 - y2)2:不同层对于电梯和楼梯一样的操作: 二分找y1和y2中间和离y1和y2最近的入口比较求得最小值#includeusing namespace std;const int maxn = 1e5 + 5;int n,
2018-05-03 00:02:19
271
原创 CodeForces - 965C Greedy Arkady
题目链接:http://codeforces.com/problemset/problem/965/C题意:k个人围成一个圈分n个糖, 选择一个x,从第一个人开始一个一个的得到x个糖,直到剩下的不足x个。求第一个人最多能拿到多少要求x小于等于M,每个人最后D*X个思路:Xmax = M, Xmin = n / (D * k + 1) + 1; ans = (n/x/k +
2018-05-02 23:52:22
461
原创 poj 2492 A Bug's Life
题目链接:http://poj.org/problem?id=2492题意:给你m对虫子 判断中间有没有同性别在一起的思路:基础种类并查集#include#include#include#include#include#include#includeusing namespace std;const int maxn = 10005;int n, m, T;
2018-04-12 00:37:01
199
原创 poj 3468 A Simple Problem with Integers
题目链接:http://poj.org/problem?id=3468题意:给你N个数,然后有M个操作。有两种类型的操作,(1)“Ca b c”,表示将区间[a,b]里的数加上c。(2)“Q a b”,表示查询区间[a,b]的数的和区间维护线段树模板题 #include<iostream>#include<cstdio>#include<cstr...
2018-04-09 00:46:08
151
原创 hdu 2795 Billboard
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2795线段树单点更新#include#include#include#include#includeusing namespace std;const int maxn = 200005;int Size, n, w, h;int H[maxn];struct line
2018-03-09 13:38:07
189
原创 hdu 2546 饭卡
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2546简单的01背包#include#include#include#include#include#includeusing namespace std;const int maxn = 1005;int n, m, W;int dp[maxn], w[maxn
2018-03-08 22:19:31
203
原创 HDU 1754 I Hate It
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1754裸线段树1:结点式存储#include#include#include#include#includeusing namespace std;const int maxn = 200005;int Size, n, m;struct line{ i
2018-03-07 21:33:18
183
原创 hdu 1166 敌兵布阵
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166不解释了,线段树经典例题。#include#include#include#include#includeusing namespace std;const int maxn = 400005;int Size, n, dat[2 * maxn];void in
2018-03-07 17:01:26
168
原创 hdu1254 推箱子
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1254题意:中文题就不说了,就是注意箱子是可以回到之前去过的位置的,下面这个是来自discuss的数据。 #include<cstdio>#include<cstring>#include<iostream>#include<algori...
2018-01-26 10:51:11
240
原创 hdu1195 Open the Lock
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1195bfs水一水 #include<cstdio>#include<cstring>#include<iostream>#include<algorithm>#include<queue>#include<map...
2018-01-25 14:12:03
217
原创 hdu2102 A计划
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2102题意:中文题就不翻译了,在T时刻前找到也行。(在变量设置的时候T和cnt一开始都是T......然后wa了好几次才发现。太蠢了)简单的bfs #include<iostream>#include<cstdio>#include<cstring...
2018-01-25 00:17:11
209
原创 hdu2437 Jerboas
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2437题意:求从起点开始到某个P点路径长度是k的倍数的最短路#include#include#include#include#include#includeusing namespace std;const int maxn = 1005;int n, m, s, k, an
2018-01-24 15:54:00
287
原创 hdu3309 Roll The Cube
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3309题意:和基础bfs不一样的就是多了一个,于是就增加相应的属性就好了简单的搜索题,需要注意的细节多 #include<iostream>#include<cstdio>#include<cstring>#include<algo...
2018-01-23 16:42:30
235
原创 hdu 2614 Beat
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2614DFS入门题#include#include#include#include#include#includeusing namespace std;const int maxn = 20;int n, Ans;int Map[maxn][maxn];int ans[
2018-01-22 13:09:43
263
原创 hdu 1534 Schedule Problem
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1534基础差分约束;#include#include#include#include#includeusing namespace std;const int maxn = 1005;const int inf = 1e9 + 7;int l[maxn];int n,
2017-11-15 01:18:44
284
原创 poj 1201 Interval
题目链接:http://poj.org/problem?id=1201题意:给你n个区间和每个区间至少要出多少个数,问你整个区间最少需要出多少个数思路:设Si为小于i的整个区间需要出的个数,则有,S(b + 1) - S(a) >= c,为了保证整张图是一个连通图,加上隐含的S(i + 1) - Si >= 0,S(i + 1) - Si <= 1.于是一个查分约束系...
2017-11-13 23:01:21
285
原创 poj 1364 King(hud 1531)
题目链接:http://poj.org/problem?id=1364题意:有n个未知数的序列,x1到xn,现在给你一些关系,这个序列从a开始b项的和与k的关系,大于和小于的关系,问有没有满足条件的序列思路:设Sx为前x-1项和,所以xi+....xj == S(j+1) - Si,于是有了S(j+1) - Si与k的大小关系;为了保证这是一个连通图,加一个源点S,连接其他点,权值为0
2017-11-13 22:49:34
250
ACM图论数据结构常见模板
2018-09-26
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人