Title description
Known inequality 1! +2! +3! +...+m! ‹N, please program to calculate the value of n specified by the user and output the integer solution of m that satisfies the inequality.
enter
Enter an integer n, where n is a positive integer in the range of int.
Output
Output the value range of m, see the output sample for the specific format.
Sample input
2000000000
Sample output
m<=12
Code content
#include<iostream>
using namespace std;
long long jiec(long long n)
{
long long i,a=1;
for(i=1;i<=n;i++)
a=a*i;
return a;
}
int main()
{
long long n,i,j,sum=0;
cin>>n;
for(i=0;n>=0;i++)
{
n=n-jiec(i);
j=i;
}
cout<<"m<="<<j-1;
return 0;
}