[暖手][学习阶段-各路杂题][HDU-1018]Big Number
来源:互联网 发布:无线图像传输 单片机 编辑:程序博客网 时间:2024/04/30 16:36
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
import java.util.Scanner;public class Main {public static void main(String[] args) {// TODO Auto-generated method stubScanner in = new Scanner(System.in);int T = in.nextInt();while(T>0){int n = in.nextInt();int len = (int) (0.5*Math.log10(2*3.1415927*n)+n*Math.log10(n/2.718281828459));System.out.println(len+1);T--;}}}
0 0
- [暖手][学习阶段-各路杂题][HDU-1018]Big Number
- [暖手][学习阶段-各路杂题][HDU-1005]Number Sequence
- [暖手][学习阶段-各路杂题][HDU-1008]Elevator
- [暖手][学习阶段-各路杂题][HDU-1020]Encoding
- [暖手][学习阶段-各路杂题][HDU-1106]排序
- [暖手][学习阶段-各路杂题][HDU-1070]Milk
- [暖手][学习阶段-各路杂题][HDU-1002]A + B Problem II
- [暖手][学习阶段-各路杂题][HDU-1012]u Calculate e
- [暖手][学习阶段-各路杂题][HDU-1017]A Mathematical Curiosity
- [暖手][学习阶段-各路杂题][HDU-1021]Fibonacci Again
- [暖手][学习阶段-各路杂题][HDU-1030]Delta-wave
- [暖手][学习阶段-各路杂题][HDU-1028]Ignatius and the Princess III
- [暖手][学习阶段-各路杂题][HDU-2101]A + B Problem Too
- [暖手][学习阶段-各路杂题][HDU-1859]最小长方形
- [暖手][学习阶段-各路杂题][HDU-1860]统计字符
- [暖手][学习阶段-各路杂题][HDU-1406]完数
- [暖手][学习阶段-各路杂题][HDU-1235]统计同成绩学生人数
- [暖手][学习阶段-各路杂题][HDU-1157]Who's in the Middle
- HDU2457 DNA repair AC自动机上的简单DP
- iOS复习笔记2:Objective-C语法基础
- U3D<<SPACESHOOT>>个人重制版。代码分享(四)游戏控制部分
- Python标准库:内置函数next(iterator[, default])
- tomcat 修改ROOT的方法
- [暖手][学习阶段-各路杂题][HDU-1018]Big Number
- POJ 1088-滑雪(dp)
- 捕鱼和分鱼
- Keil C各个库的作用
- sqlplus命令大全
- Pots(POJ 3414)
- HTML <td> 标签的 valign 属性
- 如何判断android页面加载完毕,以及模拟listview点击
- delphi控件中的 Tag 属性巧用