Big Number
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 21214    Accepted Submission(s): 9549

Problem 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 ≤ n ≤ 107 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

//Big Number

#include <stdio.h>
#include <math.h>

int main()
{
    int N;
    scanf("%d",&N);
    while(N--)
    {
        int i,m;
        double sum=1;
        scanf("%d",&m);
        for(i=1;i<=m;i++)
        {
            sum+=log10(i);
        }
        printf("%d\n",(int)sum);
    }
    return 0;
}

hdu_1018_Big Number_201308191556的更多相关文章

随机推荐

  1. 使用centos 5.x 32位系统安装astgo 2014 v7.0教程(含全套安装文件)

    版本特色: 全自动安装 安装过程中不用频繁输入yes或回车 自带完整号码归属地数据库 自带触屏版WAP ·首先确定你需要使用astgo 2014 7.0还是7.3: astgo 2014 v 7.0 ...

  2. Spring思维课程导图——bean属性的设置

  3. jQuery文档就绪

    很多jQuery代码都有如下片段: $(document).ready(function(){ //代码 }) 作用就是等文档结构加载完成后再去执行function中的代码,功能类似于window.o ...

  4. Android 微信SDK图片分享(checkArgs fail, thumbData is invalid)

    微信官网给的Demo中.图片的分享例子他是这么描述的: String url = "http://pic2.nipic.com/20090506/1478953_125254084_2.jp ...

  5. 开发日记(项目中SQL查询的优化)

    今天发现自己之前写的一些SQL查询在执行效率方面非常不理想,于是尝试做了些改进. 需求为查询国地税表和税源表中,国税有而税源没有的条目数,之前的查询如下: SELECT COUNT(NAME)     ...

  6. Java类及成员

    Java类及成员 类 类是对一类事物的的描述,是抽象的概念上的定义:类是创建对象的模板: public class TestClass { public static void main(String ...

  7. Day 27 网络编程

    目录 网络架构及演变过程 网络架构 互联网和互联网的组成 互联网的组成(教材版) 互联网的组成(科普版) 互联网的硬件组成 互联网的软件组成 OSI七层协议 物理层 数据链路层 网络架构及演变过程 网 ...

  8. map集合遍历,放入id

    背景,需要从电脑导入excel表格到网页上然后表格中公司需要对应数据库的id 通过key-value方法来对应id Office office = new Office();office.setG00 ...

  9. 1 JSONP

    一.什么是跨域访问举个栗子:在A网站中,我们希望使用Ajax来获得B网站中的特定内容.如果A网站与B网站不在同一个域中,那么就出现了跨域访问问题.你可以理解为两个域名之间不能跨过域名来发送请求或者请求 ...

  10. C 利用strtok, feof 截取字符串

    #cat /tmp/fff 10:hugetlb:/hello/06b11c9967cc0e106f5f4673246f671aa7388f623f58b250d9d9cb0f8c0f2b18 9:d ...