1550个...需要.Net 4.0支持...
System.Numerics.BigInteger Factorial(System.Numerics.BigInteger i)
{
    System.Numerics.BigInteger result = 1;
    while (true)
    {
        if (i < 2)
            return result;        result *= i;
        i--;
    }
}
Console.WriteLine(Factorial(3000).ToString().Where(c => c == '0').Count());

解决方案 »

  1.   

    尝试用LINQ写了一下
    但是没找到一个合适的类型来存储结果:
       int[] iii = Enumerable.Range(1, 3000).ToArray();
       var query=iii.Aggregate((a, b) => a * b);
      

  2.   

    有合适的类型也不行...Linq累加器的结果由集合元素类型决定,由于计算过程早已溢出,结果必须为0...
      

  3.   


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Collections;namespace ConsoleLinq
    {
        public class Program
        {
            public static void Main(string[] args)
            {          
                int n, i, j, x, s;
                string qq;//用于控制循环的退出
                int[] a = new int[10000];//存放求出来的数
                Console.Write("是否退出,退出请输入q后回车,不退出请随意输入一个字符");
                while (true)
                {
                    int k;
                    //控制是否退出循环
                   
                    qq = Console.ReadLine();
                    if (qq == "q") break;
                    //读取n
                    Console.Write("求n!的值,最大可求3200!,请输入一个数字:");
                    n = int.Parse(Console.ReadLine());
                    a[0] = 1;
                    for (i = 1; i < 10000; i++) a[i] = 0;//给数组赋初始值
                    for (i = 1; i <= n; i++)
                    {
                        x = 0;
                        s = 0;
                        for (j = 0; j < 10000; j++)
                        {
                            x = i * a[j] + s;//乘积加上进位
                            a[j] = x % 10;//每个数组单项等于上面算得的数除以10的余数
                            s = x / 10;//求出进位用于下次相加
                        }
                    }
                    for (i = 9999; i >= 0; i--) if (a[i] > 0) break;
                    Console.WriteLine("结果:{0}!共有{1}位数", n, i + 1);//打印出结果共有几位
                    Console.Write("{0}!=", n);
                    int zeroCount = 0;
                    for (j = i; j >= 0; j--)
                    {
                        if (a[j] == 0)
                        {
                            zeroCount++;
                        }
                        Console.Write(a[j]);//打印出结果
                       
                    }
                    Console.WriteLine("结果中0的个数"+ zeroCount);              
                }
            }            
        }
    }
      

  4.   


    void Main()
    {
         int n =10;
      int[] iii = Enumerable.Range(1,n).ToArray();
       var query=iii.Aggregate((a, b) => a * b);
      Console.WriteLine(n+" 的阶乘是:"+query);
           query=query.ToString().ToCharArray().Count(m => m.ToString().Equals("0"));
       Console.WriteLine("\r\n"+n+" 的阶乘中0的个数是:"+query);
    }
    /*
    10 的阶乘是:362880010 的阶乘中0的个数是:2*/
      

  5.   


    using System;namespace ConsoleApplication2
    {
        class Program
        {
            static void Main(string[] args)
            {
                int upper = 3000;
                int zeroCount = 0;            while (upper != 0)
                    zeroCount += upper /= 5;            Console.WriteLine(zeroCount);
            }
        }
    }
      

  6.   

    悲剧- - csdn的回复,容不下3000阶乘的结果,不然可以让lz自己数了。。
      

  7.   

    #include <stdio.h>
    #include <stdlib.h>
    #define MAX_NUM 3000
    #define MOD_OF_ARY 10000int main(){   
        
       static int ary[MAX_NUM] = { 1 };
       
       int i, j;
       int width; /*---表示结果的"宽度"---*/
       int current_num; /*--- 当前数字 ---*/
       
       /*--- 从大到小进行阶乘计算 ---*/
       for( width = 0 , current_num = MAX_NUM ; current_num > 1; current_num-- ){
            
            /*--- 对每一个‘分段’进行运算 ---*/
            for( i = j = 0; i <= width; i++ ){
                 
                 /*--- 当前运算的‘有效数值’ ---*/
                ary[i] = ( (j += ary[i] * current_num) ) % MOD_OF_ARY;   
                
                /*--- 当前运算的‘进位数值’ ---*/
                j /= MOD_OF_ARY;   
            }          if ( ary[i] = j ){ /*如果有进位,则索引向前推进*/
                 width++;   
            }
        }      printf ( "%d", ary[width] );       /*--- 将求的数值输出 ---*/
        for( j = width - 1; j >= 0; j-- ){
                
            printf( "%04d", ary[j] );/*--- 这里的6跟MOD_OF_ARY的位数有关 ---*/
        }      printf ("\n");   
        //system ("pause");   
    }================================
      

  8.   

    如果不是结尾有多少零的话只能强计算阶乘了。如果算结尾:
    int num=0;
    for(int i=0;i<3000;i++)
    {
        int j=i;
        while(j%5==0)
        {
            num++;
            j=j/5;
        }
    }
    return numl;
      

  9.   

    使用js的计算 代码如下
    <html>
    <head>
    <script type="text/javascript">
    function jisuan(ct)
    {
    num=0;
    for(i=1;i<ct;i++)
    {
     
      j=i;
      while(j%5==0)
      {
      num++;
      j=j/5;
      }
    }
     alert(num);
    }
    </script>
    </head>
    <body>
    <script>
    jisuan(3000);
    </script>
    </body>
    </html>结果是745
      

  10.   

    748是对的 这个没有包括3000。
    for(i=1;i<ct;i++)改为for(i=1;i<=ct;i++)
      

  11.   

    引用 31 楼 netmaster203 的回复:
    这么强大啊,呵呵,测试测试哈
    小心搞崩机了