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

最新文章

  1. Java中@Override的作用
  2. Request 和 Response 原理
  3. OpenFOAM 学习路线 【转载】
  4. eclipse安装svn和maven插件以及m2e-extras
  5. 关联规则-R语言实现
  6. c++复习一:复数运算的简单实现。
  7. 关于CStdioFile的使用问题
  8. maven系列(1)-maven的介绍与安装
  9. HDU 2435 There is a war (网络流-最小割)
  10. RabbitMQ (三) 发布/订阅
  11. 用 EPWA 写一个 图片播放器 PicturePlayer
  12. 基于netty实现的长连接,心跳机制及重连机制
  13. python3+pyshark读取wireshark数据包并追踪telnet数据流
  14. ConcurrentHashMap 源码阅读小结
  15. ios 关于屏幕旋转和屏幕晃动
  16. Hibernate与MyBatis的对比
  17. ios开发之--awakeFromNib和initWithFrame分别什么时候调用
  18. WordPress 客户端软件列表
  19. 利用Ogr将Kml转为Shape【1】
  20. OS考研复习笔记——操作系统的定义、目标、作用和发展的主要动力

热门文章

  1. Ubuntu Windows双系统重装windows后看不到ubuntu启动引导
  2. [POJ2985]The k-th Largest Group
  3. 经典DFS问题实践
  4. 关于iOS构建版本
  5. C数据结构 : 线性表 与 链表
  6. 关于vivado implement后clock interaction报告的理解(更新中)
  7. 特殊权限set_gid
  8. Linux文件系统命令 split
  9. Oracle审计策略例子
  10. uniGUI HyperServer