题目描述 也许你早就知道阶乘的含义,N阶乘是由1到N相乘而产生,如: 12! = 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x 12 = 479,001,600 12的阶乘最右边的非零位为6. 写一个程序,计算N(1<=N<=50,000,000)阶乘的最右边的非零位的值. 注意:10,000,000!有2499999个零. 输入输出格式 输入格式: 仅一行包含一个正整数N. 输出格式: 单独一行包含一个整数表示最右边的非零位的值. 输入输出样例…
传送门 我直接用 long long 暴力,居然过了 ——代码 #include <cstdio> int n; long long x, ans = 1; int main() { int i; scanf("%d", &n); for(i = 1; i <= n; i++) { x = i; while(!(x % 10)) x /= 10; x %= 1000000000; ans *= x; while(!(ans % 10)) ans /= 10;…
题目描述 也许你早就知道阶乘的含义,N阶乘是由1到N相乘而产生,如: 12! = 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x 12 = 479,001,600 12的阶乘最右边的非零位为6. 写一个程序,计算N(1<=N<=50,000,000)阶乘的最右边的非零位的值. 注意:10,000,000!有2499999个零. 输入输出格式 输入格式: 仅一行包含一个正整数N. 输出格式: 单独一行包含一个整数表示最右边的非零位的值. 输入输出样例…
A Trivial Problem Mr. Santa asks all the great programmers of the world to solve a trivial problem. He gives them an integer m and asks for the number of positive integers n, such that the factorial of n ends with exactly m zeroes. Are you among thos…
Problem Statement You are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7. Constraints 1≤N≤10^3 Input The input is given from Standard Input in the following format: N Output Print the number of the positive divisors…