Trailing Zeroes (I) LightOJ - 1028】的更多相关文章

题意就是给你一个数让你找它的正因子个数(包括自身,不包括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…
题意: 给出一个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…
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.…
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. For example, 5! = 120, 120 contains one zero on the trail. Input Input starts with an integer T (≤ 10000)…
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. For example, 5! = 120, 120 contains one zero on the trail. In…
求C(n,r)*p^q的后缀零 考虑一下 是不是就是求 10^k*m  的k的最大值 而10又是由2 和 5 组成  所以即是求 2^k1 * 5^k2 * m1 中k1和k2小的那一个数 短板效应嘛..预处理每个 1 - 1e6 的每个数字的对2分解,对5分解的次数  然后还要保存下前缀和  作为 n的阶乘中分别包含的次数 #include <iostream> #include <cstdio> #include <sstream> #include <cst…
其实有几个尾零代表10的几次方但是10=2*510^n=2^n*5^n2增长的远比5快,所以只用考虑N!中有几个5就行了 代码看别人的: https://blog.csdn.net/qq_42279796/article/details/88218061…
http://lightoj.com/volume_showproblem.php?problem=1138 Trailing Zeroes (III) Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1138 Description You task is to find minimal natural number N, so t…
1138 - Trailing Zeroes (III) PDF (English) problem=1138" style="color:rgb(79,107,114)">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…
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. For ex…