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.
2 10 20
7 19
求大数阶乘位数,有公式,,,s=log10(2*PI*n)/2+n*log10(n/e);
#include<iostream> #include<cstdio> #include<cmath> using namespace std; #define p 0.798179868358 #define e 0.434294481903 int main() { int n; long double m; long long temp; cin>>n; while(n--) { cin>>m; if(m>3) { temp=(p+log10((double)m))/2+m*(log10((double)m)-e)+1; } else { temp=1; } cout<<temp<<endl; } }