题意:给你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 ;
}

cf C On Number of Decompositions into Multipliers的更多相关文章

  1. Codeforces396A - On Number of Decompositions into Multipliers

    Portal Description 给出\(n(n\leq500)\)个\([1,10^9]\)的数,令\(m=\prod_{i=1}^n a_i\).求有多少个有序排列\(\{a_n\}\),使得 ...

  2. C. On Number of Decompositions into Multipliers 组合数学

    http://codeforces.com/contest/397/problem/C 给出n个数字,m = a[1] * a[2] * a[3] ... * a[n] 要求把m分成n个不一样的乘积, ...

  3. cf C. Prime Number

    http://codeforces.com/contest/359/problem/C 先求出分子的公因子,然后根据分子上会除以公因子会长生1,然后记录1的个数就可以. #include <cs ...

  4. Codeforces Round #232 (Div. 1)

    这次运气比较好,做出两题.本来是冲着第3题可以cdq分治做的,却没想出来,明天再想好了. A. On Number of Decompositions into Multipliers 题意:n个数a ...

  5. Codeforces Round #232 (Div. 1) A 解题报告

    A. On Number of Decompositions into Multipliers 题目连接:http://codeforces.com/contest/396/problem/A 大意: ...

  6. Codeforces Round #232 (Div. 2) C

    C. On Number of Decompositions into Multipliers time limit per test 1 second memory limit per test 2 ...

  7. NGINX(四)配置解析

    前言 nginx配置解析是在初始化ngx_cycle_t数据结构时,首先解析core模块,然后core模块依次解析自己的子模块. 配置解析过程 nginx调用ngx_conf_parse函数进行配置文 ...

  8. windows7 Cygwin 下安装 YouCompleteMe 插件

    原创文章,欢迎指正!转载请注明~ 从上周就开始想在cygwin上安装YouCompleteMe插件,按照GITHUB上的官方教程安装,由于自己的理解失误,一直搞不清是按照在windows上安装还是按照 ...

  9. 基础数位DP小结

    HDU 3555 Bomb dp[i][0] 表示含 i 位数的方案总和. sp[i][0] 表示对于位数为len 的 num 在区间[ 10^(i-1) , num/(10^(len-i)) ] 内 ...

随机推荐

  1. Apache + Tomcat集群配置详解 (1)

    一.软件准备 Apache 2.2 : http://httpd.apache.org/download.cgi,下载msi安装程序,选择no ssl版本 Tomcat 6.0 : http://to ...

  2. iOS--为视图添加阴影

    iOS–为视图添加阴影 情况一:视图添加圆角,在添加阴影 //阴影视图 self.viewShadow = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ...

  3. IOS-tableView中的cellHeadView随着table滚动

    IOS-tableView中的cellHeadView随着table滚动 设置table的style 首先要将table设置为UITableViewStyleGrouped类型.这样就会得到table ...

  4. linux下MySQL安装登录及操作

    linux下MySQL安装登录及操作 二.安装Mysql 1.下载MySQL的安装文件 安装MySQL需要下面两个文件: MySQL-server-4.0.16-0.i386.rpm MySQL-cl ...

  5. 关于Entity Framework 5 从数据库生成模型时没有字段注释的解决方法!

    目前用到了EF5进行模型创建,发现从数据库生成过来的实体中并没有包含字段的说明信息(鄙视下微软,这么简单的问题都不给解决下,太粗枝大叶了),网上找到了EFTSQLDocumentation.Gener ...

  6. 获取Android studio中的SHA1

    因为想要弄一下百度地图. 然后要申请一个key. 需要SHA1. 按window键 +R 输入cmd 进入C:\Users\Administrator路径 输入cd .android,进行.andro ...

  7. mac下开发环境常用操作与命令

    [1] 修改hosts文件 vim /private/etc/hosts

  8. SQLSERVER 触发器 将一个服务器上的数据库中数据插入到另一个服务器上的数据库中怎么做

    首先要执行 sp_addlinkedserver '服务器ip' 然后开始写语句 insert into ip.库名字.dbo.table select * from iserted

  9. iOS 常见错误:CALayer position contains NaN: [14 nan]

    Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contai ...

  10. Objective-C中的分类与协议

    分类 在谈分类之前,我们可以先探究下,OC中为什么出现分类这种机制,有什么好处? 假设你接到一个大项目:计算两个整数的和,差.接到任务的你马上动手.编写代码如下: #import <Founda ...