当前位置:网站首页>factorial factorization
factorial factorization
2022-07-29 17:14:00 【seal ink】
阶乘因式分解
时间限制: 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;
}
边栏推荐
- 召回 i2i
- Automated win training script log
- 【PCL学习笔记】点云处理常用的库和API(PCL库+Eigen)
- R语言中给数据框增加分组/根据样本名称添加分组的代码
- RocketQA: across batches negative sampling (cross - batch negatives), the denoising of strong negative cases of sampling (denoised hard negative from) and data to enhance (data augment
- 路由ISIS
- 干货!如何使用仪表构造SRv6-TE性能测试环境
- 特殊的类——集合与泛型(C#)
- 贪心(1)区间完全覆盖问题
- Recall i2i
猜你喜欢
随机推荐
Kubernetes 的 5 个误区
零花钱
可行性研究报告模板
旭硝子龟尾工厂3月起将减少30%玻璃基板供应!TCL华星、友达、群创、惠科均受影响
BUUCTF——MISC(流量分析)
溢价20%,瑞萨电子宣布拟以60亿美元收购Dialog
Automated win training script log
大数阶乘计算
中小型金融企业该如何进行灾备建设?
我的 2019 年终总结
MLX90640 infrared thermal imager development notes (9)
一文参透分布式存储系统Ceph的架构设计、集群搭建(手把手)
Property (Property Animation Animation), the basic use of Butterknife butter knife
What is the GMAT test?
Knowledge Graph Construction of Mall Commodities
(笔记)Build was configured to prefer settings repositories over project repositories but 解决方法
任正非:华为绝不会出售终端手机业务!
递归法解决N皇后问题
Dynamic planning to climb the stairs
量化初级 -- akshare获得股票代码,最简策略








