URAL 1748】的更多相关文章

题目:http://acm.timus.ru/problem.aspx?space=1&num=1748 题意:求n范围内约数个数最多的那个数. Roughly speaking, for a number to be highly composite it has to have prime factors as small as possible, but not too many of the same. If we decompose a number n in prime factor…
题目大意:找出T组不大于ni(i=1,2,3,...,T)的因子数最多的数mi(i=1,2,3,...,T),有多个数时输出最小的. KB     64bit IO Format:%I64d & %I64u 数据规模:1<=T=100,1<=ni(i=1,2,3,...,T)<=10^18. 理论基础:定理:如果:m=p1^k1*p2^k2*...那么:m的因子数=(k1+1)*(k2+1)*.... 题目分析:由定理可以知道,我们如果:(p1<p2<p3<..…
题目链接 题意 :给你一个n,让你找出小于等于n的数中因子个数最多的那个数,并且输出因子个数,如果有多个答案,输出数最小的那个 思路 : 官方题解 : (1)此题最容易想到的是穷举,但是肯定超时. (2)我们可以知道,计算约数的个数和质因数分解有着很大的联系: 若Q的质因数分解为:Q=p1^k1*p2^k2*…*pm^km(p1…pm为素数,k1…km≥1),则Q有(k1+1)(k2+1)…(km+1)个约数.但是质因数分解的时间复杂度很高,所以也会超时. (3)通过以上的公式,我们可以“突发奇…
题目链接:https://vjudge.net/problem/11177 题目大意: 求小于等于 n 的最大反素数. 分析: n <= 10^18,而前20个素数的乘积早超过10^18,因此可手动打素数表,再dfs寻找最大反素数. 代码如下: #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define INIT() std::ios::sync_with_st…
1060 最复杂的数 题目来源: Ural 1748 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 把一个数的约数个数定义为该数的复杂程度,给出一个n,求1-n中复杂程度最高的那个数.   例如:12的约数为:1 2 3 4 6 12,共6个数,所以12的复杂程度是6.如果有多个数复杂度相等,输出最小的. Input 第1行:一个数T,表示后面用作输入测试的数的数量.(1 <= T <= 100) 第2 - T + 1行:T个数,表示需要计算的n.(1 &…
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串中心位置,RMQ询问LCP = min (height[rank[l]+1] to height[rank[r]]),注意的是RMQ传入参数最好是后缀的位置,因为它们在树上的顺序未知,且左边还要+1. #include <cstdio> #include <algorithm> #in…
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and each orders a juice cocktail. It could be from 1 to 3 different juices in each cocktail. There are three juices in the bar: apple, banana and pineappl…
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best programmer in the world! Now he regularly takes part in various programming contests, attentively listens to problems analysis and upsolves problems. But…
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate integers together in their spare time. Nikolay thinks an integer is interesting if it is a prime number. However, Asya thinks an integer is interesting i…
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock band on Earth. Band decided to make the most awesome music video ever for their new single. In that music video Ilya will go through Manhattan standi…