题意:给你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. grep:Binary file (standard input) matches

    grep "key" xxx.log时输出 Binary file xxx.log matches 百度了一下:grep觉得这是二进制文件.解决方式:grep -a. grep - ...

  2. QT+QT creator+OpenCV图像灰度化

    1).pro文件 #------------------------------------------------- # # Project created by QtCreator 2014-05 ...

  3. db4o官方停止支持及面向对象数据库的一些感想

    前一段时间试用了db4o,真心认为不错.但自己在国内搜索了一下,并没有找到不论什么一个专门的论坛和面向对象的数据库产品.深感这东西在国内并没有太普及. 但自己试用认为这个东东真心不错(当然也有自己的优 ...

  4. Linq中Union与Contact方法用法对比

    文章一开始,我们来看看下面这个简单的实例. 代码片段1: int[] ints1 = { 2, 4, 9, 3, 0, 5, 1, 7 }; int[] ints2 = { 1, 3, 6, 4, 4 ...

  5. mysql 参数:[read_buffer_size] [sort_buffer_size] [read_rnd_buffer_size] [tmp_table_size]---图解

    http://imysql.cn/2008_09_27_deep_into_mysql_sort_buffer http://my.oschina.net/realfighter/blog/36442 ...

  6. HTML表单介绍

    表单语法结构如下: <form action="url" method="get|post" name="value" enctype ...

  7. 使用AVCaptureSession显示相机预览

    #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @interface ViewController ...

  8. Java基础知识强化02:import static 和 import

    1.import static静态导入是JDK1.5中的新特性.一般我们导入一个类都用 import com.....ClassName;而静态导入是这样:import static com..... ...

  9. css 选择符

    css参考手册:css.doyoe.com 在css3中,不同的浏览器可能需要不同的前缀,它表示该css属性或规则尚未成为W3C标准的一部分,是浏览器的私有属性,虽然目前较新版本的浏览器都是不需要前缀 ...

  10. EF结合SqlBulkCopy在项目中的使用

    这是我第一次写博客,由于水平有限,写不出什么好东西,还望见谅. 我现在参与的这个项目采用的是EF框架,方便了数据库的访问.但在实际中,发现项目中导入市县Excel数据耗时太长,于是趁这段时间专门研究了 ...