hdu_1018_Big Number_201308191556
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的更多相关文章
随机推荐
- eclipse的快捷键---调试
1:查看类或接口的方法 Ctrl+T 2:debug调试查看信息 Ctrl+Shift+i 3:debug调试快捷键 (1):F11好像是重新运行debug. (2):F8直接输出结果.(3):F5单 ...
- codevs3304水果姐逛街(线段数)
3304 水果姐逛水果街Ⅰ 时间限制: 2 s 空间限制: 256000 KB 题目等级 : 钻石 Diamond 题目描述 Description 水果姐今天心情不错,来到了水果街. 水果 ...
- 简单理解jsonp原理
对于javascript程序员来说,发送ajax请求获取后台数据然后把数据和模板拼接成字符串渲染回DOM实现无刷新更新页面这样的操作可谓是轻车熟路.但众所周知,ajax有一个不好,就是不能跨域传输数据 ...
- hdu2030
http://acm.hdu.edu.cn/showproblem.php?pid=2030 #include<stdio.h> #include<math.h> #inclu ...
- nginx入门学习
1.yum解决编译nginx所需的依赖包,之后你的nginx就不会报错了 yum install gcc patch libffi-devel python-devel zlib-devel bzip ...
- android 二维码 扫描,生成,竖屏
最近公司有用到二维码,生成,扫描,所以学习了一下,和大家分享: demo 见下面链接,已经改成竖屏: http://download.csdn.net/detail/q610098308/868101 ...
- 5CSS之字体font-family
---------------------------------------------------------------------------------------------------- ...
- 4CSS颜色和背景
---------------------------------------------------------------------------------------------------- ...
- Unity通过指定摄像机截屏
简介 介于照抄网上之前的截图教程,然后在实际应用过程中出现了一些小小的问题,修正了一下下,特此分享一下 PS:代码在后面 原理 原理很简单,就是将一个相机的内容渲染到一个贴图上,然后将贴图保存为图片 ...
- Spring Cloud (12) 服务网关-基础
通过前几篇介绍,已经可以构建一个简单的微服务架构了,如下图: 通过eureka实现服务注册中心以及服务注册发现,通过ribbon或feign实现服务的消费以及负载均衡,通过spring cloud c ...