2 条题解
-
412209水宇辰 (12209水宇辰) LV 9 @ 2021-12-23 20:27:26
#include <iostream> #include <cmath> using namespace std; int GetLength(double x); int main() { int n; cin>>n; double y=1; for(int x=2; x<=n; x++) y=y*x; cout<<GetLength(y)<<endl; return 0; } int GetLength(double x) { int n=0; while(x>=1) // !!!! n++, x/=10; return n; } int GetLength(int x) { int n; cin>>n; double len=0; for(int i=1; i<=n; i++) len += log(i)/log(10); cout << (int)len + 1; return 0; }
-
-42024-07-14 12:22:52@
#include <iostream>
#include <cmath>
using namespace std;
int GetLength(double x);
int main()
{
int n; cin>>n;
double y=1;
for(int x=2; x<=n; x++)
y=y*x;
cout<<GetLength(y)<<endl;
return 0;
}
int GetLength(double x)
{
int n=0;
while(x>=1) // !!!!
n++, x/=10;
return n;
}
int GetLength(int x)
{
int n; cin>>n;
double len=0;
for(int i=1; i<=n; i++)
len += log(i)/log(10);
cout << (int)len + 1;
return 0;
}
- 1
信息
- ID
- 1035
- 难度
- 7
- 分类
- (无)
- 标签
- 递交数
- 286
- 已通过
- 60
- 通过率
- 21%
- 上传者