- 博客(54)
- 资源 (83)
- 收藏
- 关注
原创 BUAACM 晴天小猪是点赞狂魔
简单题,并且数据还有问题!#include #include #include using namespace std;int main(){ int T; long long i, n; cin>>T; while (T--) { cin>>n; long long a; long long t = (n+1) * n / 2; long long k
2013-11-30 16:29:24 1268
原创 ZOJ1298, POJ1135 Domino Effect
题目大意: 你的任务是编写程序,给定多米诺骨牌游戏,计算最后倒下的是哪一张骨牌、在什么时间倒下。这些多米诺骨牌游戏包含一些“关键牌”,他们之间由一行普通骨牌连接。当一张关键牌倒下时,连接这张关键牌的所有行都开始倒下。当倒下的行到达其他还没倒下的关键骨牌时,则这些关键骨牌也开始倒下,同样也使得连接到它的所有行开始倒下。每一行骨牌可以从两个端点中的任何一张关键牌开始倒下,甚至两个端点
2013-11-29 21:36:53 825
原创 Dijkstra 算法介绍以及实现
Dijkstra算法的具体实现方法为:1. 设置两个顶点的集合T和S:a) S中存放已找到最短路径的顶点,初始时,集合S中只有一个顶点,即源点v0;b) T中存放当前还未找到最短路径的顶点;2.在T集合中选取当前长度最短的一条最短路径(v0,…,vk),从而将vk加入到顶点集合S中,并修改源点v0到T中各顶点的最短路径长度;重复这一步骤,直到所有的顶点都加入到集
2013-11-29 20:15:18 1541
原创 zoj 2048 Highways poj 1751
两题几乎就是一摸一样的,只是输入格式不一样。#include #include #include #include #include #include using namespace std;const int MAX = 1000;const int INF = 10000010;struct Point{ int x,y;} point[MAX];in
2013-11-28 13:04:42 966
原创 zoj 1914 poj 2349 Arctic Network
题目大意: 国防部想在北部的前哨之间建立一个无线网络连接这些前哨。在建立网络时使用了两种不同的通信技术:每个前哨有一个无线电收发器,有一些前哨还有一个卫星频道。 任何两个拥有卫星频道的前哨之间可以直接通过卫星进行通信,而且卫星通信跟距离和位置无关。否则,两个前哨之间通过无线电收发器进行通信,并且这两个前哨之间的距离不能超过D,这个D值取决于无线电收发器的功率。功率越大,D值也就
2013-11-28 11:24:31 717
原创 hdu 2089 不要62
#include #include #include using namespace std;int dp[10][3];int DP(int x){ bool flag = false; int s[15]; int idx = 0, sum = x, ans = 0; for(; x; x /= 10) s[++idx] = x % 10; s[idx+1] =
2013-11-27 21:50:02 664
原创 zoj 2158 poj 1789 Truck History (Prim)
题目大意: 高级货物运输公司ACM使用不同类型的卡车。有些卡车用来运蔬菜,有些用来运水果,还有一些用来运砖,等等。该公司对不同的卡车有自己的编码方法。卡车的编码为一个包含7个字符的字符串(每个位置上的字符都有特定的含义,但这一点对本题并不重要)。在ACM公司发展历史上的初期,只有一种卡车可供使用,只有一种卡车类型编码;后来又引进了新的一种卡车类型,新卡车的类型编码是从第一种卡车编码派
2013-11-27 19:56:53 865
原创 zoj 1586 QS Network (Prim)
#include #include using namespace std;const int MAXN = 1010;const int INF = 10000010;int Edge[MAXN][MAXN];int lowcost[MAXN];int adapter[MAXN];int n;void Inite(){ int i, j; cin>>n; me
2013-11-27 18:40:52 791
原创 Prim算法
一、Prim 算法的思想: 普里姆算法的基本思想是以顶点为主导地位:从起始顶点出发,通过选择当前可用的最小权值边依次把其他顶点加入到生成树当中来。设连通无向网为G(V, E),在普里姆算法中,将顶点集合V分成两个子集合T和T':T:当前生成树顶点集合,T':不属于当前生成树的顶点集合。很显然有:T∪T'= V。普里姆算法的具体过程为:1) 从连通无向网G中选择一
2013-11-27 05:07:57 2131
原创 poj 2421 Constructing Roads (Kruskal)
#include #include #include using namespace std;const int MAXM = 10050;const int MAXN = 110;struct Edge{ int u, v, w;};Edge edges[MAXM];int parent[MAXN];int n, m;void UFset(){ int
2013-11-27 03:31:35 783
原创 zoj 1372
#include #include #include #include #include #include #include #include #include #include #define Max(a,b) ((a)>(b)?(a):(b))#pragma comment(linker, "/STACK:16777216")using namespace std ;
2013-11-26 21:26:28 721
原创 zoj 1406 poj 1251 Jungle Roads
#include #include #include #include using namespace std;const int MAXN = 27;const int MAXM = 100;struct Edge{ int u, v, w;};Edge edges[MAXM];int parent[MAXN];int kcount[MAXN];int Max
2013-11-26 16:23:24 766
原创 poj 1861
#include #include #include using namespace std;const int MAXN = 1010;const int MAXM = 15010;struct Edge{ int u, v, w;};Edge edges[MAXM];int ans[MAXN];int parent[MAXN], kcount[MAXN];in
2013-11-26 13:52:40 649
原创 最小生成树 Kruskal
Kruskal思想是以边为主导地位,始终都是选择当前权值最小的边。具体算法步骤: 1) 设一个有n个顶点的连通网络为G(V, E),最初先构造一个只有n个顶点,没有边的非连通图T= { V, Ø },图中每个顶点自成一个连通分量。 2) 当在E中选择一条具有最小权值的边时,若该边的两个顶点落在不同的连通分量上,则将此边加入到T中;否则,即这条边的两个顶点落在同一个连通分量上,则
2013-11-26 11:37:15 908
原创 hdu 1575 Tr A
#include #include #include using namespace std;const int N = 10;const int modnum = 9973;struct Matrix{ int matrix[N][N];};Matrix A, I;int n, K;void Inite_Matrix(){ scanf("%d%d",&n, &
2013-11-25 21:30:46 682
原创 hdu 3065 病毒侵袭持续中 ac_automaton
用一个二维字符串数组存储,第i个病毒是什么,virus[i]代表的就是第i个病毒的数量,如果virus[i] != 0表明有这个病毒存在,printf( "%s: %d\n" ,s2[i], virus[i]);就是满足要求的输出。#include #include #include using namespace std;const int MAXN = 50010;stru
2013-11-25 01:39:29 881
原创 hdu 2896 病毒来袭 ac_automaton
本题输出的时候需要排序,其余的是跟上一题差不多,不过不是技术,而是查看是否存在,所以如果该病毒存在,则记录在一个数组里,并不改变结点的数据。#include #include #include #include using namespace std;const int MAXN = 10000010;struct Trie_Node{ int id; Trie_Nod
2013-11-25 00:37:09 748
原创 ac_automaton 模板
#include #include #include using namespace std;const int MAXN = 500010;struct Trie_Node{ Trie_Node* fail; Trie_Node* pNext[26]; int cnt; Trie_Node() { fail = NULL; cnt = 0; memset(
2013-11-24 21:54:39 845
原创 hdu 2222 Keywords Search (ac_automaton)
ac自动机:点击打开ac自动机资料#include #include #include using namespace std;const int MAXN = 500010;struct Trie_Node{ Trie_Node* fail; Trie_Node* pNext[26]; int kcount; Trie_Node()
2013-11-24 13:07:54 731
原创 hdu 2072
这个题对线段树来说有点坑! #include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int sum;char s[100000];char st[500];struct node{ in...
2013-11-23 19:11:12 742
原创 hdu 1800 Flying to the Mars
题目大意: 有一群士兵,给定这些士兵的等级,等级大的士兵可以作为教师教等级低的士兵,等级低的不能教等级高的,等级相同的也不可以互相教,每个士兵至多有一个教师(或者没有),每个教师至多有一个士兵(可以没有),问至少需要多少把扫帚? 分析:这个题可以用字典树做,因为如果等级不同,则至少需要一把,但是如果出现等级相同的,一个等级出现几个相同的,在每个等级出现相同的次数中选出一个最大...
2013-11-23 14:02:15 793
原创 hdu 1247 Hat'sWord
#include <iostream>#include <cstring>#include <cstdio>using namespace std;const int MAXN = 50010;char word[MAXN][21];struct Trie{ bool flag; Trie* pNext[26]; Trie()...
2013-11-23 13:01:43 699
原创 hdu 1075 What Are You Talking About
本文中有个函数islower()是用来检测该字符是否为小写字母的。 先建立火星文字典树,然后在每一个火星词的结束的那个字符,用来储存该火星词的英语意思。 #include <iostream>#include <cstring>#include <cstdio>using namespace std;const i...
2013-11-23 11:08:35 826
原创 1671 Phone List (Trie树)
点击打开题目 本题可以先插入,后查询,也可以便插入便查询。我用的是第二种思路。 #include <iostream>#include <cstring>#include <cstdio>using namespace std;struct Trie{ bool flag; Trie* pNext[10]; Trie()...
2013-11-21 17:41:54 774
原创 hdu 1251 统计难题 Trie
#include <iostream>#include <cstring>#include <cstdio>using namespace std;class Trie{ public: int num; Trie* pNext[26]; Trie() { num = 0; ...
2013-11-21 15:35:45 791
原创 poj 2528 Mayor's posters
题目大意: 往墙上贴海报,可以互相覆盖,问最终可以看到多少张海报?露出一部分的也算可以看到。分析: 由于本题数据比较大,因此处理时需要离散化,离散化是一种压缩区间的手段,可以降低复杂度。例如:[100,1000],[1010, 2012],[880, 2013];我们所需要的数据也就是100,1000,1010,2010,880,2013,对于[-∞,99],[101,87
2013-11-20 13:09:24 833
原创 poj 3468 A Simple Problem with Integers
#include #include #include using namespace std;#define lson l, m, rt << 1#define rson m+1, r, rt << 1 | 1typedef __int64 LL;const int MAXN = 100010;LL add[MAXN<<2];LL sum[MAXN<<2];void P
2013-11-20 08:37:10 775
原创 1698 Just a Hook 线段树区间更新
线段树区间更新,有个懒惰标记,每次更新不进行到底,,用懒惰标记使得更新延迟到下次需要更新或者询问到的时候。#include #include #include #include #define lson l, m, rt << 1#define rson m+1, r, rt << 1 | 1using namespace std;const int MAXN = 20002
2013-11-19 20:52:45 888
原创 hdu 2795 Billboard 线段树
#include #include #include #include #define lson l, m, rt << 1#define rson m+1, r, rt << 1 | 1using namespace std;const int MAXN = 222222;int h, w, n;int MAX[MAXN<<2];void PushUp(int rt)
2013-11-19 01:21:07 910
原创 1394 Minimum Inversion Number 线段树
题目大意:给定数列a[1]、a[2]··········a[n],每次将移动首项移动到末尾,每移动一次,计算数列的逆序数,在一系列移动之后,求最小的逆序数。分析: 首先求出输入序列的逆序数,然后每次取其与移动一次之后的逆序数的最小值。n-1表示最大数,n-1 - x[i]表示首项x[i]移动到数列末尾后会产生几个逆序,但是当x[i]作为首项时,会有x[i]个逆序,因此,n-1-x[i]
2013-11-18 17:48:47 848
原创 hdu 1754 I Hate It 线段树Test
#include #include using namespace std;#define lson l , m , rt << 1#define rson m + 1 , r , rt << 1 | 1const int maxn = 222222;int MAX[maxn<<2];void PushUP(int rt) { MAX[rt] = max(MAX[rt<<1] ,
2013-11-18 12:48:09 895
原创 hdu 1166 敌兵布阵 线段树
#include #include #include #include #define lson l, m, rt << 1#define rson m+1, r, rt << 1 | 1using namespace std;const int MAXN = 50010;int sum[MAXN<<2];void PushUp(int rt){ sum[rt
2013-11-18 01:39:23 832
原创 HOJ 2686 Magic-Box
三维树状数组,关键是更新时,空间想象比二维复杂些。其原理都是相同的!#include #include #include #include using namespace std;const int MAXN =210;int c[MAXN][MAXN][MAXN];inline int lowbit(int x){ return x & (-x);}v
2013-11-17 15:08:08 919
原创 poj 2029 Get Many Persimmon Trees
本题可以二维树状数组的思想来解决,暴力好像也可以,数据比较小。用二维树状数组,就是枚举指定长宽的矩阵内*号的个数,并求出数目最大的。#include #include #include #include using namespace std;const int MAXN = 110;int c[MAXN][MAXN];int lowbit(int x){ r
2013-11-17 13:38:20 818
原创 poj 2481 Cows
题目大意: 给定你一些区间,去判断每个区间是其他区间真子集的个数。分析: 本题与Stars有点类似。首先对E从大到小排序,如果Ei = Ej 则让S从小到大排序,然后就是stars类型。就是求cow[i].S前比他小的个数。 #include #include #include #include using namespace std;
2013-11-17 11:38:15 834
原创 poj 2299 Ultra-QuickSort
本题就是求逆序数,在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。 令t[i]表示逆序对(a[j],i)的个数,即排在i的左边且比i大的数的个数,则逆序数为t[1]+t[2]+···t[n] 例l设n=8,a={3,2,l,5,8,4,6,7},t[1] = 2 ,t[2]
2013-11-16 21:04:59 789
原创 poj 3067 Japan
#include #include #include #include using namespace std;const int MAXN = 1010;long long c[MAXN];struct Node{ int x, y;}node[MAXN*MAXN];int lowbit( int x ){ return x & (-x);}
2013-11-16 16:00:57 803
原创 poj 1019 Number Squence
题目大意: 给定N组数字串,每个数字串都是从1,2······按升序排列的正整数,例如:1 12 123 1234 12345 123456·····,问第n位所指的数字是几?例如:1 12 123 1234 12345······ 第3位是2,第六位是3,第8位是2。 分析: 如果是1--9的数字,每一个数占一位,10--99每个数字占2位,100--999每个数
2013-11-15 21:44:55 632
原创 HOJ Stars 2678
这个题与poj的思路有点类似 点击打开poj Stars#include #include #include using namespace std;const int MAXN = 1010;int c[MAXN][MAXN];struct Node{ int x, y, z;}stars[15010];int cmp(Node a, Node b){ i
2013-11-14 21:49:42 976
原创 poj Stars 2352
#include #include #include using namespace std;const int MAXN = 32010;int c[MAXN];int lowbit( int x ){ return x&(-x);}void UFset(int pos, int data){ while(pos < MAXN) {
2013-11-14 18:41:55 898
从Word Embedding到Bert模型—自然语言处理中的预训练技术发展史
2018-11-19
word2vec系列资料
2018-11-19
word2vec 中的数学原理详解
2018-11-01
CRF++0.58-Linux+Windows
2018-09-29
npp++32位+NPPTextFx.dll
2018-09-27
李航-《统计学习方法》高清完整版(带书签)
2018-09-17
Stanford NLP note - Christopher Manning教授-完整吧
2018-08-08
Stanford NLP note - Christopher Manning教授
2018-08-08
21天学通Java-第7版-超清带书签.pdf
2018-07-27
计算机统计自然语言处理PDF
2018-07-26
Tensorflow 实战Google深度学习框架-清晰-带书签
2018-01-17
TensorFlow Machine Learning Cookbook.pdf
2018-01-17
最大熵模型与自然语言处理
2017-09-01
cudnn 5.1 for CUDA 8.0 Linux
2017-07-05
李宏毅 一天搞懂深度学习.ppt版下载
2017-02-23
机器学习实战(中文带书签+英文+源代码)
2016-10-26
《机器学习》----[Tom M. Mitchell]--带书签
2016-10-16
《统计学习方法》李航-带书签高清完整PDF版
2016-10-16
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人