Codeforces Round #232 (Div. 2) C
1 second
256 megabytes
standard input
standard output
You are given an integer m as a product of integers a1, a2, ... an
. Your task is to find the number of distinct decompositions of number m into the product of n ordered positive integers.
Decomposition into n products, given in the input, must also be considered in the answer. As the answer can be very large, print it modulo1000000007 (109 + 7).
The first line contains positive integer n (1 ≤ n ≤ 500). The second line contains space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109).
In a single line print a single number k — the number of distinct decompositions of number m into n ordered multipliers modulo 1000000007(109 + 7).
1
15
1
分析:用map存储每个素数的个数接着就是组合公式c(n+k-1,k-1),因为是乘法所以相当于往盒子里面放小球盒子可以为空。因此多出n个盒子
1 #include<cstring>
2 #include<cstdio>
3 #include<algorithm>
4 #include<map>
5 typedef long long LL;
6 using namespace std;
7 const int MAX =;
8 const int F = 1e6+;
9 const int MOD = 1e9+;
map<int , int > m;
int a[MAX];
LL c[][MAX];
void getp(int n)
{
long long i;
for(i=;(long long)i*i<=n;i++)
{
while(n%i==)
{
m[i]++;
n/=i;
}
}
if( n != ) m[n]++;
}
void init()
{
c[][]=;
for(int i=;i<;i++)
{
c[i][i]=c[i][]=;
for(int j=;j<=min(i,MAX);j++)
{
c[i][j]=(c[i-][j]+c[i-][j-])%MOD;
}
}
}
int main()
{
int n;
LL ans;
while(scanf("%d",&n)==)
{
m.clear(); ans=;
for(int i=;i<n;i++)
{
scanf("%d",&a[i]);
getp(a[i]);
}
init();
//printf("s");
for(map<int,int> ::iterator it=m.begin();it!=m.end();it++)
{
int k=it->second;
ans=ans*c[k-+n][n-]%MOD;
}
printf("%I64d\n",ans);
}
return ;
60 }
Codeforces Round #232 (Div. 2) C的更多相关文章
- Codeforces Round #232 (Div. 2) B. On Corruption and Numbers
题目:http://codeforces.com/contest/397/problem/B 题意:给一个n ,求能不能在[l, r]的区间内的数字相加得到, 数字可多次重复.. 比赛的时候没有想出来 ...
- Codeforces Round #232 (Div. 1)
这次运气比较好,做出两题.本来是冲着第3题可以cdq分治做的,却没想出来,明天再想好了. A. On Number of Decompositions into Multipliers 题意:n个数a ...
- Codeforces Round #232 (Div. 1) A 解题报告
A. On Number of Decompositions into Multipliers 题目连接:http://codeforces.com/contest/396/problem/A 大意: ...
- Codeforces Round #232 (Div. 2) D. On Sum of Fractions
D. On Sum of Fractions Let's assume that v(n) is the largest prime number, that does not exceed n; u ...
- Codeforces Round #232 (Div. 2) On Sum of Fractions
Let's assume that v(n) is the largest prime number, that does not exceed n; u(n) is the smallest pri ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
随机推荐
- Springboot拦截器线上代码失效
今天想测试下线上代码,能否正常的执行未登录的拦截.所以把拦截器的代码给开放出来,但是没想到线上代码addInerceptors(InterceptorRegistry registry) 这个方法一直 ...
- 状态压缩+枚举 UVA 11464 Even Parity
题目传送门 /* 题意:求最少改变多少个0成1,使得每一个元素四周的和为偶数 状态压缩+枚举:枚举第一行的所有可能(1<<n),下一行完全能够由上一行递推出来,b数组保存该位置需要填什么 ...
- css为tbody或者li奇数偶数行样式
<style> table tbody tr:nth-child(odd){ background:#fff; } table tbody tr:nth-child(even){ back ...
- 转 MySQL实验(三) 过程式数据库对象的使用
转 http://blog.csdn.net/anne999/article/details/70432558
- 273 Integer to English Words 整数转换英文表示
将非负整数转换为其对应的英文表示,给定的输入是保证小于 231 - 1 的.示例:123 -> "One Hundred Twenty Three"12345 -> & ...
- sublime 3 最新注册码
http://9iphp.com/web/html/sublime-text-3-license-key.html
- 解析SQLite中的常见问题与总结详解
1. 创建数据如果不往数据库里面添加任何的表,这个数据库等于没有建立,不会在硬盘上产生任何文件,如果数据库已经存在,则会打开这个数据库. 2. 如何通过sqlite3.dll与sqlite3.def生 ...
- win7如何设置自动关机
如果想设置Win7按照自己意愿自动关机,而又不希望下载安装第三方软件,则可以通过以下两个方法来简单实现. 工具/原料 Windows7操作系统环境 方法1:利用cmd命令 1 打开cmd窗口. 方法一 ...
- JS求斐波那契数列的N项
第一种求法: <!DOCTYPE html><html lang="en"><head> <meta charset="UTF- ...
- 配置Tomcat && Http简介
WEB环境搭建 1. Web服务器 Web服务器主要用来接收客户端发送的请求和响应客户端请求. 作为JavaWeb程序来说,还需要有Servet容器,容器的主要作用就是调用java程序处理用户发送的请 ...