题意: 给出一个N 求N有多少个别的进制的数有后导零 解析: 对于一个别的进制的数要转化为10进制 (我们暂且只分析二进制就好啦) An * 2^(n-1) + An-1 * 2^(n-2) + ``````+ A1 * 2^1  +  A0 * 2^0  = N 因为有后导零 我们暂且只看有一个后导零的情况  即A0 = 0 那么  2 * ( An * 2^(n-2) + An01 * 2^(n-3) + `````` + A1) = N 即  An * 2^(n-2) + An-1 * 2…
题意就是给你一个数让你找它的正因子个数(包括自身,不包括1),这个地方用到一个公式,如果不用的话按正常思路来写会TL什么的反正就是不容易写对. 求任意一个大于1的整数的正因子个数 首先任意一个数n,n=P1^a1 * P2^a2 * P3^a3 *……Pn^an: 任意的整数n可以分解为m个素数ai次幂的连续乘机,这个地方解释不清自己再理解一下(Pi都为素数,依次往后pi越来越大,ai就是次幂,自己可以找几个任意整数n来套一下这个公式就会明白了) 然后正因子个数和:sum=(1+a1)*(1+a…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1028 题意:给你一个数 n (1<=n<=10^12), 然后我们可以把它转化为k(k>=2)进制的数,但是要满足转化之后的数的最后一位是0,求这样的k共有多少个 其实就是求n的大于1的因子有多少个; 一个数n可以写成 n = p1^a1 * p2^a2 * p3^a3 * ... pk^ak(其中pi是n的素因子)那么n的所有因子个数根据乘法原理就是(a1+1)*(a2+1…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1138 题意:给你一个数n,然后找个一个最小的数x,使得x!的末尾有n个0:如果没有输出impossible 可以用二分求结果,重点是求一个数的阶乘中末尾含有0的个数,一定和因子5和2的个数有关,因子为2的明显比5多,所以我们只需要求一个数的阶乘的因子中一共有多少个5即可; LL Find(LL x) { LL ans = ; while(x) { ans += x/; x /= ;…
Given an integer n, return the number of trailing zeroes in n!. Example 1: Input: 3 Output: 0 Explanation: 3! = 6, no trailing zero. Example 2: Input: 5 Output: 1 Explanation: 5! = 120, one trailing zero. 考虑n!的质数因子.后缀0总是由质因子2和质因子5相乘得来的.如果我们可以计数2和5的个数…
题意:给n和k,求组合C(n,k)的因子个数. 这道题,若一开始先预处理出C[i][j]的大小,再按普通方法枚举2~sqrt(C[i][j])来求解对应的因子个数,会TLE.所以得用别的方法. 在说方法前,先说一个n!的性质:n!的素因子分解中的素数p的个数为n/p+n/(p^2)+...+n/(p^k)+... <ACM-ICPC程序设计系列 数论及应用>上的方法,200+ms:首先先求解435以内的素因子.然后预处理出j!中每个素因子的个数,公式如下:num[j][i]=j/prime[i…
1138 - Trailing Zeroes (III)   PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N.…
---恢复内容开始--- We guessed some integer number xx. You are given a list of almost all its divisors. Almost all means that there are all divisors except 11and xx in the list. Your task is to find the minimum possible integer xx that can be the guessed nu…
Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 主要是思考清楚计算过程: 将一个数进行因式分解,含有几个5就可以得出几个0(与偶数相乘). 代码很简单. public class Solution { public int trailingZeroes(int n) { int result =…
Easy Number Challenge Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 236B Appoint description:  System Crawler  (2016-04-26) Description Let's denote d(n) as the number of divisors of a…