CF1973F Maximum GCD Sum Queries 题解 题目链接点击打开链接题目解法首先想到枚举两个数列的 gcdgcd,求最小代价 两个数列的 gcdgcd 应该分别是 a1,b1a1,b1 的因数 或 b1,a1b1,a1 的因数 这样就把枚举范围缩小到了 d(a1)×d(b1)d(a1)×d(b1),这求最小代价需要 O(n)O(n),不够快...
The little girl found the problem rather boring. She decided to reorder the array elements before replying to the queries in a way that makes the sum of query replies maximum possible. Your task is to find the value of this maximum sum. Input The first line contains two space-separated int...
Maximum splitting(规律,数论) You are given several queries. In thei-th query you are given a single positive integerni. You are to representnias a sum of maximum possible number of composite summands and print this maximum number, or print-1, if there are no such splittings. An integer ...
1511B-GCDLength.cpp 1511C-YetAnotherCardDeck.cpp 1511D-MinCostString.cpp 1512A-SpyDetected.cpp 1512B-AlmostRectangle.cpp 1512C-ABPalindrome.cpp 1512D-CorruptedArray.cpp 1512E-PermutationBySum.cpp 1512G-ShortTask.cpp 1513A-ArrayAndPeaks.cpp 1514A-PerfectlyImperfectArray.cpp 1514B-And0SumBig.cp...