- 阶乘末尾的0
- @ 2026-04-04 21:08:23
#include <bits/stdc++.h>
using namespace std;
int main()
{
int q;
cin>>q;
int cnt=0;
for(int i=1;;i++)
{
int x=i;
while(x%5==0)//只数 5 的数量
{
cnt++;
x/=5;
}
if(cnt==q)
{
cout<<i;
return 0;
}
if(cnt>q) break;
}
cout<<"No solution";
return 0;
}
0 条评论
目前还没有评论...
信息
- ID
- 1009
- 难度
- 5
- 分类
- (无)
- 标签
- 递交数
- 155
- 已通过
- 48
- 通过率
- 31%
- 被复制
- 7
- 上传者