- 博客(10)
- 收藏
- 关注
原创 初学莫队算法 bzoj2038 小z的袜子 分块算法
http://www.lydsy.com/JudgeOnline/problem.php?id=2038【莫队算法讲解推荐】https://www.cnblogs.com/Paul-Guderian/p/6933799.html【莫队算法个人理解】对于一般不带修改的区间问题,离线查询的算法。(有事可以处理带修改的问题,还不会)给出n个数的序列,有m次查询,查询区间[l,r]的一些信息,如某个数字出现的次数。莫队算法精髓在于,根据前一次的询问[l’,r’]递推出当前区间[l,r]的答案,当两区间很近
2017-11-30 10:36:43 11258 1
原创 C++字符串分割和C语言常用格式控制
C++string的输出格式控制输出一个字符串:左对齐,字宽为10,空格填充[cpp] view plain copystring s; cin>>s; cout'*')输入:love输出效果:love******C++string字符流字符分割技巧输入一行字符串,然后按
2017-11-28 20:06:49 782
原创 两序列相乘的第k大元素
4875: 第k大数时间限制: 10 Sec 内存限制: 128 MB提交: 63 解决: 21[提交][状态][讨论版]题目描述有两个序列a,b,它们的长度分别为n和m,那么将两个序列中的元素对应相乘后得到的n*m个元素从大到小排列后的第k个元素是什么?输入输入的第一行为一个正整数T (T<=10),代表一共有T组测试数据。每组测试数据的第一行有三个正整数n,m和k(1<=n, m<=100000,1<=k<=n*m),分别代表a序列的长度,b序列的长度,以及所求元素的下
2017-11-26 21:21:56 2289
原创 二维dp 之 完美序列
4874: 完美序列时间限制: 1 Sec 内存限制: 128 MB提交: 28 解决: 17[提交][状态][讨论版]题目描述已知一个长度为l的序列:b1,b2,b3,…,bl (1<=b1<=b2<=b3<=…<=bl<=n)。若这个序列满足每个元素是它后续元素的因子,换句话说就是对于任意的i (2<=i<=l)都满足bi%bi-1=0 (其中“%”代表求余),则称这个序列是完美的。你的任务是对于给定的n和l,计算出一共有多少序列是完美序列。由于答案很大,所有输出答案对10000000
2017-11-26 20:56:19 831
原创 UVa12096集合栈计算机(集合操作)
Background from Wikipedia: “Set theory is abranch of mathematics created principally by theGerman mathematician Georg Cantor at the end ofthe 19th century. Initially controversial, set theoryhas come to play the role of a foundational theoryin modern
2017-11-26 20:42:16 625
原创 福建第六届省赛 H 贪心 哈夫曼思想
ZB loves playing StarCraft and he likes Zerg most!One day, when ZB was playing SC2, he came up with an idea:He wants to change the queen's ability, the queen's new ability is to choose a worker at any time, and turn it into an egg, after K units of tim
2017-11-20 17:39:34 719
原创 福建第六届省赛 G题 字符串最大乘积dp
Recently, you have found your interest in string theory. Here is an interesting question about strings.You are given a string S of length n consisting of the first k lowercase letters.You are required to find two non-empty substrings (note that substri
2017-11-20 16:41:18 692
原创 福建第六届省赛 最长连续串(贪心)
ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(including 1 and M). A straight is a sequence of cards with consecutive values. Values do not wrap around, so 1 does not come after M. In addit
2017-11-19 20:30:28 532
原创 洛谷P3031 [USACO11NOV](中位数,树状数组)
题目描述Farmer John has lined up his N (1 <= N <= 100,000) cows in a row to measure their heights; cow i has height H_i (1 <= H_i <= 1,000,000,000) nanometers--FJ believes in precise measurements! He wants to take a picture of some contiguous subsequence of
2017-11-02 08:50:30 774
原创 欧拉函数 codeforces 776E - The Holmes Children
The Holmes children are fighting over who amongst them is the cleverest.Mycroft asked Sherlock and Eurus to find value of f(n), where f(1) = 1 and for n ≥ 2, f(n) is the number of distinct ordered positive integer pairs (x, y) that satisfy x + y = n and
2017-11-01 10:59:37 1454
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人