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;
    }
    


  • 相关阅读:
    常用的STL
    CString,string,char数组的转换
    linux知识
    十一种通用滤波算法(转)
    修复被勒索病毒cl0p损坏的svn代码
    android shell 转发代理shell示例
    3proxy配置
    windbg调试写dmp,随机名字
    nexus6p刷机注意
    mysql语句学习
  • 原文地址:https://www.cnblogs.com/codeyuan/p/4254439.html
Copyright © 2011-2022 走看看