当前位置:网站首页>阶乘因式分解
阶乘因式分解
2022-07-29 16:00:00 【封子墨】
阶乘因式分解
时间限制: 3 Sec 内存限制: 64 MB
题目描述
给定两个数m,n,其中m是一个素数。
将n(0<=n<=10000)的阶乘分解质因数,求其中有多少个m。
输入
第一行是一个整数s(s<=100,s>0),表示测试数据的组数
随后的s行, 每行有两个整数n,m。
输出
输出m的个数。
样例输入
2
100 5
16 2
样例输出
24
15
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
int n,m,k=0;
scanf("%d %d",&n,&m);
while(n!=0)
{
n=n/m;
k+=n;
}
printf("%d\n",k);
}
return 0;
}
边栏推荐
猜你喜欢
随机推荐
Dry goods!How to Construct SRv6-TE Performance Test Environment Using Instrumentation
【服务器存储数据恢复】华为OceanStor某型号存储raid5硬盘故障离线,热备盘同步数据失败导致raid崩溃的数据恢复案例
How should small and medium-sized financial enterprises carry out disaster recovery construction?
Interviewer: What are the design principles?What is the Lie Substitution Principle?
华虹半导体四季度营收再创历史新高,同比增长15.4%
MLX90640 infrared thermal imager development notes (9)
Jenkins 如何玩转接口自动化测试?
3分钟带你了解微信小程序开发
如何在C语言中定义自己的数据类型?
win10 校验sha256
任正非:华为绝不会出售终端手机业务!
SQL 开始日期、结束日期查询
数字孪生万物可视 | 联接现实世界与数字空间
远程桌面工具推荐
打卡广汽本田喜悦安全驾驶中心,体验最刁钻的场地训练
图文结合纯c手写内存池
中小型金融企业该如何进行灾备建设?
一文读懂Elephant Swap,为何为ePLATO带来如此高的溢价?
[极客大挑战 2019]BabySQL 1
Flutter动态化 | Fair 2.6.0 新版本特性

![[PCL study notes] Commonly used libraries and APIs for point cloud processing (PCL library Eigen)](/img/b6/0f6113109aef776c777cb25a0ffb95.png)







