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连试试水的深浅..... ...
随机推荐
- vue商品详情页添加动画(eg)
<template> <div class="food" transition="move"></div> </tem ...
- [App Store Connect帮助]六、测试 Beta 版本(1)TestFlight Beta 版测试概述(iOS、Apple TVOS、watchOS)
TestFlight Beta 版测试让您可以分发您 App 的 Beta 版构建版本给测试员并收集反馈.您可以在您的 App Store Connect 帐户中一次为至多 100 个 App 启用 ...
- [App Store Connect帮助]五、管理构建版本(2)查看构建版本和文件大小
您可以查看您为某个 App 上传的所有构建版本,和由 App Store 创建的变体版本的大小.一些构建版本在该 App 发布到 App Store 上后可能不会显示. 必要职能:“帐户持有人”职能. ...
- VBNET AUTOCAD NETAPI 让插件随autocad启动
定义一个函数,随AutoCAD 启动加载当前程序集到autocad,涉及到写入注册表,注意这是在autocad内部加载dll之后处理的方法.... 写入HKLM表示所有登录的用户都会受影响(autoc ...
- mycat重启报错Failed to connect to the Wrapper at port解决方法
报错信息 ERROR | wrapper | 2018/05/11 14:01:55 | Startup failed: Timed out waiting for a signal from the ...
- 如何保证access_token长期有效--微信公众平台开发
http://blog.csdn.net/qq_33556185/article/details/52758781 import javax.servlet.ServletContext; impor ...
- 实现grep命令
#include <stdio.h> #include <string.h> #include <stdlib.h> // grep命令:grep match_pa ...
- DFS POJ 3087 Shuffle'm Up
题目传送门 /* 题意:两块扑克牌按照顺序叠起来后,把下半部分给第一块,上半部给第二块,一直持续下去,直到叠成指定的样子 DFS:直接模拟搜索,用map记录该字符串是否被搜过.读懂题目是关键. */ ...
- 记录从数据库把数据初始化mongodb缓存的一些坑
在项目启动时,需要做一些项目启动后的预操作,比如初始化数据进缓存等等. 这时就需要写listener,等监听.在项目启动时把数据缓存进mongodb. 但是这会有一个问题.项目一般都是把各种bean交 ...
- checkbox全选和取消功能
这是开发中常见的小功能,想当初我也曾对于attr和prop的不了解踩过坑. 前端工作中,常常会使用到select复选框,select复选框有一个属性checked,当使用js或者jquery控制这个属 ...