自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(35)
  • 资源 (2)
  • 收藏
  • 关注

原创 hdu 6140 Hybrid Crystals(数学+思维)

http://acm.hdu.edu.cn/showproblem.php?pid=6140 题目大意:先给你一个数字n和一个整数k,再给你n个数字和对应的一些英文字母,’N’表示这个数字可正可负。‘L’代表这个数字只能是正的,‘D’代表这个数字只能是负的,如果这些数字的和可以等于k就输出yes否则就输出no。 解题思路:根据基本的数学知识,只要这些数字的和最大值和最小值,只要这个k介于这两个数

2017-08-27 19:06:27 407

原创 hdu 6138 Fleet of the Eternal Throne(AC自动机)

http://acm.hdu.edu.cn/showproblem.php?pid=6138 题目大意:给出n个字符串后,会有q个询问,每个询问会输入两个数,记为x,y。然后要求的是,x,y的 最长公共子串,而且这个最长公共子串要是n个字符串中某个字符串的前缀。输出这个串的长度。 解题思路:这题的题意很明确,首先我们要求出x,y串的公共子串,然后要在n个字符串中出现过。这样就可以用的AC自动

2017-08-21 22:04:32 339

原创 AC自动机入门详解+例题 hdu2222

首先简要介绍一下AC自动机:Aho-Corasick automation,该算法在1975年产生于贝尔实验室,是著名的多模匹配算法之一。一个常见的例子就是给出n个单词,再给出一段包含m个字符的文章,让你找出有多少个单词在文章里出现过。要搞懂AC自动机,先得有字典树Trie和KMP模式匹配算法的基础知识。KMP算法是单模式串的字符匹配算法,AC自动机是多模式串的字符匹配算法。因为AC自动机算法是建立

2017-08-21 17:06:53 508

原创 hdu 6134 Battlestation Operational (莫比乌斯反演+线性筛法+差分)

http://acm.hdu.edu.cn/showproblem.php?pid=6134 题目大意:给你一个n,求f(n)=∑ni=1∑ij=1⌈ij⌉其中gcd(i,j)=1f(n)=\sum_{i=1}^{n}\sum_{j=1}^{i}\left \lceil \frac{i}{j} \right \rceil其中 gcd\left ( i,j \right ) = 1。解题思路:根据已

2017-08-19 09:52:32 801

原创 hdu 6127 Hard challenge

http://acm.hdu.edu.cn/showproblem.php?pid=6127 Problem Description There are n points on the plane, and the ith points has a value vali, and its coordinate is (xi,yi). It is guaranteed that no two po

2017-08-17 10:54:53 366

原创 hdu 6129 Just do it

http://acm.hdu.edu.cn/showproblem.php?pid=6129 Problem Description There is a nonnegative integer sequence a1…n of length n. HazelFan wants to do a type of transformation called prefix-XOR, which mea

2017-08-17 10:19:12 286

原创 poj 3233 Matrix Power Series

http://poj.org/problem?id=3233 DescriptionGiven a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak.InputThe input contains exactly one test case. The first line of input

2017-08-16 11:28:36 321

原创 矩阵快速幂之整数快速幂

如果现在要算X^8:则 X*X*X*X*X*X*X*X 按照寻常思路,一个一个往上面乘,则乘法运算进行7次。 但如果我们这样算 (X*X)(X*X)(X*X)*(X*X) 这种求法,先进行乘法得X^2,然后对X^2再执行三次乘法,这样去计算,则乘法运算执行4次。已经比七次要少。所以为了快速算的整数幂,就会考虑这种结合的思想。 现在的问题是如何分配才能让乘法运算的次数最少。 例如:

2017-08-16 10:48:12 411

原创 hdu 6124 Euler theorem(水题)

http://acm.hdu.edu.cn/showproblem.php?pid=6124 Problem Description HazelFan is given two positive integers a,b, and he wants to calculate amodb. But now he forgets the value of b and only remember th

2017-08-15 23:40:02 635 1

原创 hdu 1575 Tr A(矩阵快速幂 入门)

http://acm.hdu.edu.cn/showproblem.php?pid=1575 Problem Description A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。Input 数据的第一行是一个T,表示有T组数据。 每组数据的第一行有n(2 <= n <= 10)和k(2 <= k < 10^9)两个数据。接下来有n行,每行有n

2017-08-15 23:31:15 376

原创 hud 1298 T9(字典树 + DFS详解)

http://acm.hdu.edu.cn/showproblem.php?pid=1298 Problem Description A while ago it was quite cumbersome to create a message for the Short Message Service (SMS) on a mobile phone. This was because you

2017-08-15 23:10:31 787

原创 hdu 2846 Repository

http://acm.hdu.edu.cn/showproblem.php?pid=2846 Problem Description When you go shopping, you can search in repository for avalible merchandises by the computers and internet. First you give the searc

2017-08-14 21:48:12 434

原创 hdu 1247 Hat’s Words(字典树)

http://acm.hdu.edu.cn/showproblem.php?pid=1247 Problem Description A hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary. You are to find al

2017-08-14 21:25:27 283

原创 hdu 2072 单词数(字典树入门题)

http://acm.hdu.edu.cn/showproblem.php?pid=2072 Problem Description lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。Input 有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没有标点符号,

2017-08-14 21:16:44 1102

原创 hdu 6103 Kirinriki(尺取法)

http://acm.hdu.edu.cn/showproblem.php?pid=6103 Problem Description We define the distance of two strings A and B with same length n is disA,B=∑i=0n−1|Ai−Bn−1−i| The difference between the two chara

2017-08-14 09:20:39 391

原创 hdu 6105 Gameia (博弈)

http://acm.hdu.edu.cn/showproblem.php?pid=6105 Problem Description Alice and Bob are playing a game called ‘Gameia ? Gameia !’. The game goes like this : 0. There is a tree with all node unpainted i

2017-08-14 00:04:21 456

原创 hud 6097 Mindis(几何)

http://acm.hdu.edu.cn/showproblem.php?pid=6097 Problem Description The center coordinate of the circle C is O, the coordinate of O is (0,0) , and the radius is r. P and Q are two points not outside

2017-08-13 23:52:05 636

原创 hdu 6096 String(详解)

http://acm.hdu.edu.cn/showproblem.php?pid=6096 Problem Description Bob has a dictionary with N words in it. Now there is a list of words in which the middle part of the word has continuous letters d

2017-08-12 22:06:25 830

原创 hdu 1542 Atlantis (线段树之扫描线)

http://acm.hdu.edu.cn/showproblem.php?pid=1542 Problem Description There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps

2017-08-11 16:59:41 1837 1

原创 hud 3460 Ancient Printer

http://acm.hdu.edu.cn/showproblem.php?pid=3460 Problem Description The contest is beginning! While preparing the contest, iSea wanted to print the teams’ names separately on a single paper. Unfortun

2017-08-11 10:40:02 369

原创 hud 1075 What Are You Talking About (字典树或map)

http://acm.hdu.edu.cn/showproblem.php?pid=1075 Problem Description Ignatius is so lucky that he met a Martian yesterday. But he didn’t know the language the Martians use. The Martian gives him a hist

2017-08-10 19:48:39 383

原创 统计难题(字典树或map容器)

http://acm.hdu.edu.cn/showproblem.php?pid=1251 题目大意:给你一个字符串列表,后边给出一些字符串,查询这些字符串作为前缀出现过多少次线段树解法#include <bits/stdc++.h>#define N 26using namespace std;struct Trie{ int cnt; Trie *next[N];

2017-08-09 21:22:40 345

原创 字典树

在一个单词列表中查找某个单词是否出现过#include <iostream>#include<cstdlib>#define MAX 26using namespace std;typedef struct TrieNode //Trie结点声明{ bool isStr; //标记该结点处是

2017-08-09 19:15:50 293

原创 hdu 1305 Immediate Decodability (字典树入门)

http://acm.hdu.edu.cn/showproblem.php?pid=1305 题目大意:给你一系列字符串,以9位分割线,判断在某个集合里的字符串有没有作为其他字符串的前缀出现。 解题思路:典型的字典树的题,只需要在构造字典树的时候判断这个节点是否可以构成字符串,且为叶子结点。这里出现前缀有两种情况,一是这个字符串还没有插入完,但已经遇到被标记的字符,二是,这个字符串已经插入完,但

2017-08-09 18:10:34 570 1

原创 hdu 6060 RXD and dividing 2017多校第三场第五题(思维+dfs)

hdu 6060 RXD and dividing 题目大意,一棵树有n个节点,1为根节点,将2~n这n各节点分为k部分。这k个部分没有交集,可以为空,求1到k部分的和最大。 解题思路:这里提到了最小斯坦纳树,对此一无所知不知道要怎么弄,后来发现这里有n个节点n-1条边这样形成的树本来就是一棵最小生成树了,然后最小生成树又是斯坦纳树的一种特殊情况,所以这里可以忽略斯坦纳树的情况。而我们需要考虑

2017-08-09 11:16:18 339

原创 hud Rikka with Subset 2017 多校第五场 (背包)

Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:Yuta has n positive A1−An and their su

2017-08-08 20:54:19 352

原创 hdu 6050 Funny Function

hdu 6050 Funny Function 根据题目所给的递推公式我们可以打表出n=10以内的数据,寻找规律,当然对于这种给了你递推公式,我们可以利用Excel表格来找规律,这个题最后的规律: 因为题上给的数据比较大,所以这里我们算整数幂的时候要用整数快速幂,还有个知识点就是这里牵涉到一个对一个除数取余的事情,这里要用到逆元+费马小定理 费马小定理: 假如p是质数,且gcd(a,p

2017-08-08 09:21:58 324

原创 hdu 6058 Kanade's sum(思维)

hud 6058 Kanade’s sum 题目大意:给你一个数组 a ,要求你求出a的所有子区间中第k大值的和。 解题思路:要找每个区间的第k大值,数据比较大,直接找肯定超时,所以我们不妨可可反着想,考虑一下每个值作为第k大有多少种情况,这样只需一次线性扫描就可以了,时间复杂度是O(n)。那么如何找呢? 我们只要求出对于一个数x左边最近的k个比他大的和右边最近k个比他大的,扫一下就可以知道有

2017-08-07 12:05:56 685

原创 hud 6078 Wavel Sequence

hud 6078 Wavel Sequence 题目大意:给你两个序列a,b,让你找出两个函数 f 和 g 使得 a[f]=b[g],并且a[f1],a[f2],a[f3]……a[fk]满足 序列a1 < a2 > a3 < a4……为你满足关系的 f 和 g有多少种 解题思路:不难想到我们可以单独考虑每个数字,看它作为波峰有多少种情况,波谷有多少种情况,然后求和。但是具体怎么求每个数字作为波峰

2017-08-07 11:08:54 388

原创 hud 6069 Counting Divisors(数学题 约数定理)

原题链接 hud 6069 题目大意:题目上给出 l , r ,k 求从 l 到 r 范围内 i 的 k次方的所有约数个数的和。 解题思路:因为题目上给的 l ,r,和 k 的值比较大,不能直接暴力求解,要用到数学上的一个知识点 约数定理: 对于一个大于1的整数n,可以分解质因数n = p1^a1 * p2^a2 * p3^a3 · ·· ··· pn^an,其中p1,p2,……pn为质数

2017-08-06 21:57:28 418

原创 hdu 6040 Hints of sd0061

Problem Description sd0061, the legend of Beihang University ACM-ICPC Team, retired last year leaving a group of noobs. Noobs have no idea how to deal with m coming contests. sd0061 has left a set of

2017-08-06 13:11:14 349

原创 hud 6038 Function

Problem Description You are given a permutation a from 0 to n−1 and a permutation b from 0 to m−1.Define that the domain of function f is the set of integers from 0 to n−1, and the range of it is the

2017-08-06 11:53:26 287

原创 Balala Power! (模拟)

Problem DescriptionTalented Mr.Tang has n strings consisting of only lower case characters. He wants to charge them with Balala Power (he could change each character ranged from a to z into each number

2017-08-06 10:08:52 750

原创 Colorful Tree(逆向思维)

Problem Description There is a tree with n nodes, each of which has a type of color represented by an integer, where the color of node i is ci.The path between each two different nodes is unique, of w

2017-08-06 00:00:14 1250

原创 hdu 6073 Matching In Multiplication (二分图与拓补排序)

Problem Description In the mathematical discipline of graph theory, a bipartite graph is a graph whose vertices can be divided into two disjoint sets U and V (that is, U and V are each independent set

2017-08-05 13:30:51 520 2

灰狼优化算法(Grey Wolf Optimizer).pdf

最原始的灰狼优化算法,全面解释了灰狼优化算法的来源和基础应用,适合初学者。群智能优化算法,灰狼优化算法

2019-07-29

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除