题意:给你n个数,然后把这个n个数的乘积化成n个数相乘,可以化成多少个。

思路:分解质因数,求出每一个质因子的个数,然后用组合数学中隔板法把这些质因子分成n分,答案就是所有质因子划分成n份的情况的乘积。

 #include <cstdio>
#include <cstring>
#include <map>
#include <algorithm>
#define maxn 100100
#define ll long long
using namespace std;
const int mod=; int n;
int a[maxn];
ll c[][]; int main()
{
scanf("%d",&n);
map<int,int>q;
c[][]=;
for(int i=; i<=; i++)
{
c[i][]=;
for(int j=; j<=; j++)
{
c[i][j]=(c[i-][j-]+c[i-][j])%mod;
}
}
for(int i=; i<=n; i++)
{
scanf("%d",&a[i]);
int m=a[i];
for(int i=; i*i<=m; i++)
{
if(m%i==)
{
while(m%i==)
{
q[i]++;
m/=i;
}
}
}
if(m>)
{
q[m]++;
}
}
ll ans=;
map<int,int>::iterator it;
for(it=q.begin(); it!=q.end(); it++)
{
int xx=it->second;
ans*=c[xx+n-][n-];
ans%=mod;
}
printf("%lld\n",ans);
return ;
}

最新文章

  1. 1.2.1 OC概述
  2. js 反显查询。
  3. [开源 .NET 跨平台 数据采集 爬虫框架: DotnetSpider] [一] 初衷与架构设计
  4. mysql-模拟全连接处理
  5. 使用 IntraWeb (39) - THttpRequest、THttpReply
  6. XE3随笔11:Merge、Clone、ForcePath
  7. [原创]java WEB学习笔记77:Hibernate学习之路---Hibernate 版本 helloword 与 解析,.环境搭建,hibernate.cfg.xml文件及参数说明,持久化类,对象-关系映射文件.hbm.xml,Hibernate API (Configuration 类,SessionFactory 接口,Session 接口,Transaction(事务))
  8. android----Java DES加密算法工具类
  9. Windows Tomcat 安装
  10. 用python的numpy作线性拟合、多项式拟合、对数拟合
  11. Wpf 鼠标拖动元素实例
  12. OpenWrt的主Makefile工作过程
  13. win10 uwp Window.Current.Dispatcher中Current为null
  14. mybatis循环、mybatis传map
  15. 云栖大会day1 上午
  16. DSL 系列(2) - 插件的论述与实现
  17. .Net Core 自定义配置源从配置中心读取配置
  18. docker-compose批量管理docker容器
  19. python3.6.4没有raw_input
  20. calayer defaultValueForKey

热门文章

  1. POJ3723 Conscription
  2. Android 微信SDK分享功能中的最全过程步骤分析
  3. Shell编程速查手册
  4. Qt 学习之路 :文件
  5. xslt中的常用函数
  6. android学习笔记----JNI中的c控制java
  7. Bginfo软件在域的部署和应用
  8. VBA开发中的前绑定与后绑定
  9. 转 sqlserver字段描述相关操作sql
  10. vs2013下的WCFRest 模板开发WCF