分类 - 数论、数学

? 解题记录 ? ? BZOJ ? ? 莫比乌斯函数 ? ? 容斥 ?    2018-08-13 11:42:45    590    0    0
【题目描述】给出A,B,考虑所有满足l<=a<=A,l<=b<=B,且不存在n>1使得n^2同时整除a和b的有序数,对(a,b),求其lcm(a,b)之和。答案模2^30。 【输入】第一行一个整数T表示数据组数。接下来T行每行两个整数A,B表示一组数据。 T ≤ 2000,A,B ≤ 4 × 10^6 【输出】对每组数据输出一行一个整数表示答案模2^30的值 【输入样例】5 2 2 4 6 3 4 5 1 23333 33333 【输出样例】7 148 48 15 451085813​   这道题网上很多题解是化出了一个函数然后快速求这个函数
? 解题记录 ? ? HDU ? ? cdq分治 ? ? FFT|NTT ?    2018-07-27 10:33:39    685    0    0
Problem Description Perhaps the sea‘s definition of a shell is the pearl. However, in my view, a shell necklace with n beautiful shells contains the most sincere feeling for my best lover Arrietty, but even that is not enough.Suppose the shell necklace is a sequence of shells (not a chain end to end
? 解题记录 ? ? Atcoder ? ? 构造 ?    2018-07-15 12:01:23    670    0    0
Problem StatementWe have a grid with H rows and W columns of squares. We will represent the square at the i-th row from the top and j-th column from the left as (i, j). Also, we will define the distance between the squares (i1, j1) and (i2,
? 解题记录 ? ? HDU ? ? 群论 ?    2018-07-15 10:34:36    483    0    0
Problem Description You may not know this but it's a fact that Xinghai Square is Asia's largest city square. It is located in Dalian and, of course, a landmark of the city. It's an ideal place for outing any time of the year. And now:    There are N children from a near
? 解题记录 ? ? Atcoder ? ? 组合数 ?    2018-07-13 23:08:24    1232    0    0
Problem StatementIn Republic of AtCoder, Snuke Chameleons (Family: Chamaeleonidae, Genus: Bartaberia) are very popular pets. Ringo keeps N" data-mce-tabindex="0">NN Snuke Chameleons in a cage. A Snuke Chameleon that has not eaten anything is blue. It changes its color according to the f
? 解题记录 ? ? Codeforces ? ? 扩展欧几里得 ?    2018-07-05 23:00:10    676    0    0
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider a billiard table of rectangular size n&#x00D7;m" data-mce-tabindex="0">n×mn×m with four pockets. Let's introduce a coordinate system with the origin at th
? 解题记录 ? ? BZOJ ? ? 斯特林数 ? ? FFT|NTT ?    2018-06-30 09:09:36    639    0    0
Description “简单无向图”是指无重边、无自环的无向图(不一定连通)。 一个带标号的图的价值定义为每个点度数的k次方的和。 给定n和k,请计算所有n个点的带标号的简单无向图的价值之和。 因为答案很大,请对998244353取模输出。 Input 第一行包含两个正整数n,k(1<=n<=10^9,1<=k<=200000)。 Output 输出一行一个整数,即答案对998244353取模的结果。 Sample Input 6 5 Sample Output 67584000 HINT Source 本OJ付费获取 \
? 解题记录 ? ? 洛谷 ?    2018-06-09 23:03:15    379    0    0
题目描述Byteasar runs a confectionery in Byteburg. Strawberry-vanilla flavoured lollipops are the favourite of local children. These lollipops are composed of multiple segments of the same length, each segment of either strawberry or vanilla flavour. The price of the lollipop is the sum of the values of
? 解题记录 ? ? 杂OJ ? ? 堆 ?    2018-05-15 21:51:18    643    1    1
描述给定一个长度为 n 的非负整数序列 a[1..n]。 你每次可以花费 1 的代价给某个 a[i] 加1或者减1。 求最少需要多少代价能将这个序列变成一个不上升序列。 输入第一行一个正整数 n。 接下来 n 行每行一个非负整数,第 i 行表示 a[i]。 1 ≤ n ≤ 500000 0 < a[i] ≤ 109 输出一个非负整数,表示答案。 样例解释[5,3,4,5] -> [5,4,4,4] 样例输入 4 5 3 4 5样例输出 2​&nbs
? 解题记录 ? ? 洛谷 ?    2018-05-15 13:02:35    473    0    0
题目描述We consider the distance between positive integers in this problem, defined as follows. A single operation consists in either multiplying a given number by a prime number1 or dividing it by a prime number (if it does divide without a remainder). The distance between the numbers  and&nb