hdu 1018
来源:互联网 发布:数组长度最大是多少 编辑:程序博客网 时间:2024/06/05 04:00
Big Number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 19232 Accepted Submission(s): 8623
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
21020
Sample Output
719
Source
Asia 2002, Dhaka (Bengal)
Recommend
JGShining
//求n阶乘的数的位数。也就是求log10(n!) + 1。//log10(n!)=log10(1)+log10(2)+…+log10(n);#include <stdio.h>#include <math.h>int main(){int t, n, i;double d;scanf("%d", &t);while(t--){d = 1.0;scanf("%d", &n);for(i = 1; i <= n; i++)d += log10(i);printf("%d\n", (int)d);}return 0;}
- hdu 1018
- hdu 1018
- HDU 1018
- hdu 1018
- hdu 1018
- hdu-1018
- hdu 1018
- HDU 1018
- HDU 1018
- hdu 1018
- HDU-1018
- HDU-1018
- hdu 1018
- hdu 1018
- hdu 1018
- HDU 1018
- hdu 1018
- hdu 1018
- 面试题:类型转换与优先级问题
- 求一个矩阵中最大的二维矩阵(元素和最大)
- 题目1031:xxx定律
- discuz马甲
- android 之 中断线程
- hdu 1018
- 程序员练级攻略(转载)
- android--windows 类详细介绍
- 5个常用Java 代码混淆器 助你保护你的代码
- 几个国外优秀PPT模版网站
- 在Fedora等Linux系统中利用Adb连接Android手机
- Linux挂载U盘
- vc文件操作,内存映射
- 学习小杂记