题意 $t$ 组询问, 每组询问给定 $n$ , 求 $\sum_{k = 1} ^ n [n, k]$ . $t \le 300000, n \le 1000000$ . 一些常用的式子以及证明 $\phi(n) = \sum_{d = 1} ^ n [(d, n) = 1]$ . 说明 用数学语 ...
分类:
其他好文 时间:
2017-07-26 15:43:41
阅读次数:
227
Consider two integer sequences f(n) = n! and g(n) = an, where n is a positive integer. For any integer a > 1 the second sequence is greater than the f ...
分类:
其他好文 时间:
2017-07-24 13:03:17
阅读次数:
150
题目链接:https://vjudge.net/contest/70655#problem/C 后缀数组的又一神奇应用。不同子串的个数,实际上就是所有后缀的不同前缀的个数。 考虑所有的后缀按照rank排好了,我们现在已知height,也就是相邻的两个的最长公共前缀是多少。那么不同的子串个数怎么统计呢 ...
分类:
编程语言 时间:
2017-07-23 10:00:22
阅读次数:
172
题目链接:http://www.spoj.com/problems/DQUERY/ 题目大意:给定一个数组,每次询问一个区间内的不同元素的个数 解题思路:直接套莫队的裸体 ...
分类:
编程语言 时间:
2017-07-18 11:44:49
阅读次数:
178
GSS4 - Can you answer these queries IV http://www.spoj.com/problems/GSS4/ #tree #tree You are given a sequence A of N(N <= 100,000) positive integers. ...
分类:
其他好文 时间:
2017-07-16 19:29:13
阅读次数:
153
题意: 一棵n个节点的树,节点有黑白两种颜色,初始均为白色。两种操作:1.更改一个节点的颜色;2.询问一个节点所处的颜色相同的联通块的大小。 思路: 1.每个节点记录仅考虑其子树时,假设其为黑色时所处的黑色联通块的大小和假设其为白色时所处的白色联通块的大小(树状数组维护)。 2.查询时找到深度最小的 ...
分类:
其他好文 时间:
2017-07-16 11:15:39
阅读次数:
279
Mr. Ant has 3 boxes and the infinite number of marbles. Now he wants to know the number of ways he can put marbles in these three boxes when the follo ...
分类:
其他好文 时间:
2017-07-15 13:47:17
阅读次数:
145
The problem is about Mr.BG who is a great hunter. Today he has gone to a dense forest for hunting and killing animals. Sadly, he has only one bullet i ...
分类:
其他好文 时间:
2017-07-15 13:46:28
阅读次数:
148
Description 给定k个长度不超过L的01串,求有多少长度为n的01串S满足: 1.该串是回文串 2.该串不存在两个不重叠的子串,在给定的k个串中。 即不存在a<=b<c<=d,S[a,b]是k个串中的一个,S[c,d]是k个串中的一个 (It does not contain two no ...
分类:
其他好文 时间:
2017-07-13 21:56:18
阅读次数:
252