zoukankan      html  css  js  c++  java
  • POJ 1423

    Big Number
    Time Limit: 1000MS Memory Limit: 65536K
    Total Submissions: 25714 Accepted: 8229

    Description
    In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you have to determine the number of digits in the factorial of the number.

    Input
    Input consists of several lines of integer numbers. The first line contains an integer n, which is the number of cases to be tested, followed by n lines, one integer 1 <= m <= 10^7 on each line.

    Output
    The output contains the number of digits in the factorial of the integers appearing in the input.

    Sample Input

    2
    10
    20

    Sample Output

    7
    19

    Source
    Dhaka 2002

    <span style="color:#000099;">#include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<cmath>
    double sum;
    int n,t;
    int ans[10000007];
    int main()
    {
      memset(ans,0,sizeof(ans));
      ans[1]=1;
      for(int i=2;i<10000001;i++)
      {
       sum+=log10(1.0*i);
       ans[i]=(int)sum+1;
      }
      scanf("%d",&n);
      while(n--)
      { sum=0;
       scanf("%d",&t);
       printf("%d
    ",ans[t]);}</span>
       return 0;
    }
    


  • 相关阅读:
    about java
    nginx+tomcat
    sed
    百度推送
    线程及更新ui线程的简单理解
    测试异常检测的Bugly使用
    轮播图带加点,带时间自动轮播加手动轮播
    自定义listView与scrollView使用
    tabLayout加viewPager的实现
    网络获取图片列表
  • 原文地址:https://www.cnblogs.com/codeyuan/p/4254439.html
Copyright © 2011-2022 走看看