http://acm.hdu.edu.cn/showproblem.php?pid=1018

Big Number

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 41932    Accepted Submission(s): 20544

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
题目大意:求阶乘位数,数据很大。
题目分析:斯特林公式   X的阶乘位数==llog10(1)+log10(2)+···+long10(n)取整后加1
 #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
double sum=1.0;
scanf("%d",&n);
for(double i = ; i <= n ;i++)
{
sum+=log10(i);
}
cout << (long)sum << endl;
}
return ;
}
 

【HDOJ1018】【大数阶乘位数】【斯特林公式】的更多相关文章

  1. nyoj___大数阶乘

    http://acm.nyist.net/JudgeOnline/problem.php?pid=28 大数阶乘 时间限制:3000 ms  |  内存限制:65535 KB 难度:3 描述 我们都知 ...

  2. 大数阶乘 nyoj

    大数阶乘 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,我们该如何去计算它并输出它?   输入 输入一个整数 ...

  3. 大数阶乘(c++实现)

    #include <iostream>using namespace std;#define N 1000int BigNumFactorial(int Num[], int n);voi ...

  4. nyist28大数阶乘

    http://acm.nyist.net/JudgeOnline/problem.php?pid=28 大数阶乘 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 我们 ...

  5. 大数阶乘(c语言)

    大数阶乘.代码比较简单. #include<stdio.h> #include<string.h> #define MAXN 25000 // 如果你的阶乘N比较大,建议大一点 ...

  6. 【大数阶乘】NYOJ-28

    大数阶乘 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,我们该如何去计算它并输出它?   输入 输入一个整数 ...

  7. HDU 1018(阶乘位数 数学)

    题意是求 n 的阶乘的位数. 直接求 n 的阶乘再求其位数是不行的,开始时思路很扯淡,想直接用一个数组存每个数阶乘的位数,用变量 tmp 去存 n 与 n - 1 的阶乘的最高位的数的乘积,那么 n ...

  8. 【ACM】大数阶乘 - Java BigInteger实现

    大数阶乘 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,我们该如何去计算它并输出它?   输入 输入一个整数 ...

  9. HDU 1133 Buy the Ticket (数学、大数阶乘)

    Buy the Ticket Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)To ...

随机推荐

  1. liunx 随笔集

    Linux 安装时 Customize Now(自定义选包)选包如下 base system  ->  base , compatibility libraries,debugging Tool ...

  2. 高效方便的IO库: System.IO.Pipelines

    我们在编写网络程序的时候,经常会进行如下操作: 申请一个缓冲区 从数据源中读入数据至缓冲区 解析缓冲区的数据 重复第2步 表面上看来这是一个很常规而简单的操作,但实际使用过程中往往存在如下痛点: 数据 ...

  3. dgango中admin下添加搜索功能

    admin下添加搜索功能: 在表单中加入search_fields = ['ip','hostname']   可模糊匹配 当有人在管理搜索框中进行搜索时,Django将搜索查询分解成单词,并返回包含 ...

  4. 微信小程序图表插件 - wx-charts

    微信小程序图表插件(wx-charts)基于canvas绘制,体积小巧支持图表类型饼图.线图.柱状图 .区域图等图表图形绘制,目前wx-charts是微信小程序图表插件中比较强大好使的一个. wx-c ...

  5. 获得本机Ip地址

  6. JS日期工具类(转)

    javascript Date format(js日期格式化) https://www.cnblogs.com/zhangpengshou/archive/2012/07/19/2599053.htm ...

  7. Spring学习二

    Spring的表达式语言 SpEL,使用方法是#{} SpEL的特性如下 使用Bean 的ID 来引用Bean : 调用方法和访问对象的属性: 对值进行算术.关系和逻辑运算: 正则表达式匹配: 集合操 ...

  8. Alpha冲刺2

    前言 队名:拖鞋旅游队 组长博客:https://www.cnblogs.com/Sulumer/p/9960487.html 作业博客:https://edu.cnblogs.com/campus/ ...

  9. L327 找灵魂伴侣

    Looking for the Perfect Partner I'm sure we all remember a time when we fell in love. For some it wa ...

  10. xampp 修改 时区为中国. timezone

    注意: xampp中的timezone 总共有两处. 第一处: 是 php.ini 默认的配置项. 第二处:是xampp在 php.ini 中重写. 之前我 只修改了 941行的代码, 结果 2013 ...