HDU - 1018 Big Number
2016-09-30 10:17
267 查看
题目:
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
Sample Output
斯特林公式
代码:
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
斯特林公式
代码:
#include<iostream> #include<cmath> using namespace std; int main() { int t, n; cin >> t; while (t--) { cin >> n; cout << int(log10(2 * acos(-1.0)*n) / 2 + (log10(n) - 1 / log(10))*n + 1 / log(10) / n / 12)+1<<endl; } return 0; }
相关文章推荐
- HDU 1018 Big Number(斯特林公式)
- 求位数 hdu 1018 Big Number
- HDU 1018 Big Number(斯特林公式)
- HDU-1018 Big Number
- HDU 1018 Big Number数论(解题报告)
- hdu1018 Big Number(斯特林公式)
- hdu - 1018 - Big Number
- HDU 1018 Big Number
- HDU 1018 Big Number(数学知识)
- HDU 1018 Big Number
- hdu_1018_Big Number_201308191556
- HDU_1018 big number
- HDU-1018 Big Number 斯特林公式
- 【HDU】 1018 Big Number
- hdu 1018 Big Number
- hdu 1018 Big Number (求一个数的阶乘的位数,公式!!!)
- Big Number(http://acm.hdu.edu.cn/showproblem.php?pid=1018)
- HDU - 1018 -Big Number
- HDU 1018 Big Number(求n!的位数)
- hdu 1018 Big Number