- 博客(36)
- 资源 (64)
- 收藏
- 关注
原创 [RQNOJ 696] 【树形DP】
70scores?有更优做法请在下方评论qwq#include#include#include#include#include#includeusing namespace std;char _c;int _flag;inline void read(int& _x){ _c = getchar();_flag = false;_x=0; while(_c'9'){i
2016-09-27 16:51:45 319
翻译 CodeForces570C - Replacement
DescriptionDaniel has a string s, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation ofreplacement as the following sequence of steps: find a
2016-09-26 21:18:29 478
翻译 CodeForces570B - Simple Game
DescriptionOne day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from1 to n. Let's assume that Misha chose numberm, and Andrew chose nu
2016-09-26 21:16:45 508
翻译 CodeForces570A - Elections
DescriptionThe country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.The elector
2016-09-26 21:15:15 473
原创 [ZJOI 2013] bzoj3110 K大数查询 【树套树】
Description有N个位置,M个操作。操作有两种,每次操作如果是1 a b c的形式表示在第a个位置到第b个位置,每个位置加入一个数c如果是2 a b c形式,表示询问从第a个位置到第b个位置,第C大的数是多少。Input第一行N,M接下来M行,每行形如1 a b c或2 a b cOutput输出每个询问的结果Sample Input
2016-09-26 17:40:14 544
原创 [poj 2155]Matrix [2D BIT][二维线段树]
DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 We can change the matrix in the fol
2016-09-26 10:30:27 447
原创 【poj 1741】Tree 【树分治 点分治入门题】
TreeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 18550 Accepted: 6069DescriptionGive a tree with n vertices,each edge has a length(positive integer l
2016-09-26 08:15:54 763
原创 FPS 集合 [Trie树]
>【问题描述】有一种特殊的集合叫做 PFS( Prefix Free Set)集合。一个 PFS 集合由若干字符串构成,且不存在一个字符串是另一个字符串的前缀。空集也被看作是 PFS 集合。例 如 {"hello"} 和 {"hello", "goodbye", "giant", "hi"} 是 pfs 集 合 , 但{"hello","hell"} 和{"great","gi
2016-09-25 16:55:27 661
原创 【并查集】构造完全图
【问题描述】对于完全图G,若有且仅有一棵最小生成树为T,则称完全图G是树T的扩展出的。给你一棵树T,找出T能扩展出的边权和最小的完全图G。【文件输入】第一行N表示树T的点数。接下来N-1行: Si, Ti, Di;描述一条边( Si,Ti)权值为 Di。保证输入数据构成一棵树。【文件输出】一个数,表示最小的图G的边权和。【 样例输入】41 2 11
2016-09-25 16:08:15 2511 1
转载 git-ssh 配置和使用
1、设置Git的user name和email:(如果是第一次的话) $ git config --global user.name "humingx" $ git config --global user.email "humingx@yeah.net"2、生成密钥 $ ssh-keygen -t rsa -C "humingx@yeah.net"连续3个
2016-09-25 15:28:11 743
原创 B - poset
不想打了。。分配小组(poset.pas)[问题描述]有N个Mars人想要进行一项活动。他们需要分成几个小组,每个人属于其中一个小组。Mars人从出生起每个人就有一个印记,这个印记是个正整数。如果B的印记是A的倍数,那么B就是A的父亲。与地球人的定义不现,一个Mars人可以有多个父亲。特别的,A不是自己的父亲,但是所有其他与A的印记相同的人都是A的父亲。因此,除了A自己
2016-09-20 15:54:42 408
原创 C - Wall
套路题。。一眼看去以为是组合数学乱搞题。。然后思路想错了。。MDZZ。。。最后还是用DP搞的。本以为可以一维,不过发现还是要2维,然而某大神看了数列的4个数字就猜出了规律!(好劲啊!!下一代YJQ的节奏!!不管了,先膜一发再说!)所以。。其实是套路对吧?果然我还是见识的套路少了。。#include#include#include#include#includeusing na
2016-09-20 15:15:26 428
原创 A - dry
贪心+堆 可过#include#include#include#include#include#includeusing namespace std;typedef long long LL;inline void read(LL& x){ char c=getchar();bool flag=0;x=0; while(c'9'){if(c=='-')flag=true;
2016-09-20 15:12:15 306
原创 Conquer a New Region, ACM/ICPC Changchun 2012, UVa1664
#include#include#include#include#includeusing namespace std;#define maxn 200010int n;typedef long long LL;struct edge{ int u,v,c; bool operator < (const edge _t)const{ return c>_t.c; }}e
2016-09-20 08:20:21 475
原创 Sentry Robots, ACM/ICPC SWERC 2012, UVa12549 【二分图】
#includeusing namespace std;const int N = 5002;const int maxn = 101;char g[maxn][maxn];int Yid[maxn][maxn],Y_cnt;int match[N];int dfsT[N],dfsTime;vector G[N];#define PB push_backbool dfs(in
2016-09-19 21:04:20 481
原创 数字 【DP+容斥】
#include#include#include#include#includeusing namespace std;inline void read(int& x){ char c = getchar();x = 0;bool flag = false; while(c'9')c=='-'?flag=true:1,c=getchar(); while(c>='0'&&c<=
2016-09-19 20:38:57 611
原创 【summary】mat 【万恶溢出!!】
教训:int*int除了考虑最后答案溢出还要考虑中间溢出呀!(唔。。虽然最后全部换成了LL)#include#include#include#include#includeusing namespace std;typedef long long LL;typedef long double LD;void read(LL& x){ char c = getchar();x
2016-09-19 19:07:08 762
原创 HDU2119 Matrix 【最小点覆盖】
#include#include#include#include#include#includeusing namespace std;int n,m;vector v[110];int link[110];bool use[110];//,dfsT;bool dfs(int u){ int size = v[u].size(); for(int i=0;i<size;
2016-09-19 12:10:13 515 1
原创 【codevs 1222】 信与信封问题
#include#include#include#include#includeusing namespace std;#define maxn 110int n;bool d[maxn][maxn],vis[maxn];int link_fa[maxn],link_son[maxn];int ans = 0;bool dfs(int u){ for(int i=1;i<
2016-09-19 10:14:40 412
原创 Purifying Machine, ACM/ICPC Beijing 2005, UVa1663
#include#include#include#include#includeusing namespace std;int n,m,M;const int maxn = 10;const int N = 1<<maxn;bool vis[N];char s[2500];int link[N];int dT[N], dfsTime;bool dfs(int u){ f
2016-09-17 18:00:13 433
原创 [codevs 1245] 最小的N个和
#include#include#include#include#include#includeusing namespace std;#define maxn 100010int n;int a[maxn],b[maxn];int ans[maxn];priority_queue > q;int main(void){ scanf("%d",&n); for(re
2016-09-16 16:19:51 672
原创 [codevs] 1029 遍历问题
看了这道题才发现自己对二叉树的遍历的性质还不够熟悉。本题答案就是2^n(n是对某个节点,它只有一个儿子,这种形式的点的个数)为什么?因为要使得先序遍历和后序遍历可以得出不同的树,必然是在叶节点处,不是满二叉树。一棵二叉树的前序遍历a1a2a3...ai和后序遍历b1b2b3...bi有一种关系:当只有一棵子树的根 在a序列下标为i, 在b序列下标为b有 a[i-
2016-09-16 15:27:46 321
转载 机器学习,深度学习等概念区别【转】
1、人工智能->机器学习->深度学习 注:->包含关系2、机器学习领域: 模式识别=机器学习 数据挖掘=机器学习+数据库 统计学习=机器学习 计算机视觉=图像处理+机器学习 语音识别=语音处理+机器学习 自然语言处理=文字处理+机器学习 (搜索引擎)3、机器学习算
2016-09-15 17:33:45 4792 1
原创 Cable TV Network, ACM/ICPC SEERC 2004, UVa1660【Dinic 最小割 拆点】
#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;const int maxn = 102;int n,m;struct edge{ int to,cap,next;};vector E;vector bak;int hea
2016-09-12 12:03:28 434
原创 Lift Hopping, UVa 10801【Floyd】
#include#include#include#include#include#includeusing namespace std;int n,k;int v[10];vector can[10];int dis[110][110];#define INF 1e9int main(void){ int tmp; while(scanf("%d%d",&n,&k)=
2016-09-12 09:18:16 317
原创 【最大流问题 dinic算法】Internet Bandwidth, ACM/ICPC World Finals 2000, UVa820
#include#include#include#include#include#includeusing namespace std;int n,s,t,m;const int MAXM = 160000; const int MAXN = 400; const int INF = 0x3f3f3f3f; struct edge{ int to,cap,next;}
2016-09-11 17:12:11 705
原创 【NOIP2013】day1
第一题:转圈游戏 http://codevs.cn/problem/3285/本题的答案就是Ans = (x+m*10^k) mod n 这个没什么好说的,只是算法要用快速幂。#include#include#include#include#includeusing namespace std;int n,m,k,x;typedef long long ll;ll mul(
2016-09-11 12:33:04 385
原创 prim算法+优化 模版
#include //大概要这些头文件#include#include#include#includeusing namespace std;typedef pair pii;int head[30],next[200],point[200],val[200],size,dist[30]; //前向星及dist数组bool vis[30];void add (in
2016-09-06 16:54:56 670
原创 [codevs 1078] prim算法练习
#include#include#include#include#includeusing namespace std;int n;#define maxn 110int ans,d[maxn][maxn],dis[maxn];bool vis[maxn];int main(void){ cin>>n; for(int i=1;i<=n;i++) for(int j=
2016-09-06 16:31:24 514
原创 [Uva 1001] Say Cheese [Floyd]
#include#include#include#include#includeusing namespace std;int n;#define maxn 110struct data{ int x,y,z; int r; void read(bool flag){ scanf("%d%d%d",&x,&y,&z); if(flag)scanf("%d",&r);
2016-09-06 08:29:13 397
翻译 【Uva 821】Page Hopping 翻译+题解
It was recently reported that, on the average, only 19 clicks are necessary to move from any page onthe World Wide Web to any other page. That is, if the pages on the web are viewed as nodes in a
2016-09-05 17:19:37 629
原创 test·B·Summary
#include#include#include#include#includeusing namespace std;void read(int& x){ x = 0; char c = getchar(); bool flag = 0; while(c'9') { if(c=='-')flag=1; c = getchar(); } while(c>='0'
2016-09-05 16:34:52 336
原创 test·A·Summary
#include#include#include#include#includeusing namespace std;void read(int& x){ x = 0; char c = getchar(); bool flag = 0; while(c'9') { if(c=='-')flag=1; c = getchar(); } while(c>='0'
2016-09-05 14:54:28 208
原创 [codevs 2822] 爱在心中 【tarjan 算法】
题目描述 Description“每个人都拥有一个梦,即使彼此不相同,能够与你分享,无论失败成功都会感动。爱因为在心中,平凡而不平庸,世界就像迷宫,却又让我们此刻相逢Our Home。”在爱的国度里有N个人,在他们的心中都有着一个爱的名单,上面记载着他所爱的人(不会出现自爱的情况)。爱是具有传递性的,即如果A爱B,B爱C,则A也爱C。如果有这样一部分人,他们彼此都相爱,则他们就超越
2016-09-05 08:34:03 433
转载 STL之deque容器详解
出自http://www.cnblogs.com/scandy-yuan/archive/2013/01/09/2853603.htmlDeque 容器deque容器是C++标准模版库(STL,Standard Template Library)中的部分内容。deque容器类与vector类似,支持随机访问和快速插入删除,它在容器中某一位置上的操作所花费的是线性时间。与vect
2016-09-04 11:45:46 591
C++_STL使用例子大全
2016-07-30
Learning the vi and Vim Editors
2016-07-28
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人