using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Demo_JieCheng
{
class Program
{
static void Main(string[] args)
{
int i, j, n, c, s,count=0;
int[] f = new int[Int16.MaxValue];
string demo = Console.ReadLine();
n = Int32.Parse(demo);
f[0] = 1;
for (i = 2; i <= n; i++)
{
c = 0;
for (j = 0; j <Int16.MaxValue; j++)
{
s = f[j] * i + c;
f[j] = s % 10;
c = s / 10;
}
}
for (j = Int16.MaxValue-1; j >= 0; j--)
if (f[j] != 0) break;
for (i = j; i >= 0; i--)
{
if (f[i] == 0) count++;
Console.Write(f[i]);
}
Console.WriteLine();
Console.WriteLine(count);
Console.ReadKey();
}
}
}
计算大数阶乘 并统计'0'的个数
最新推荐文章于 2017-06-05 17:34:06 发布