codeforces396A
sol:很显然就是找出所有质因数,然后分别塞进去就行了,怎么塞就是组合数。感觉就是道小学奥数题
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
inline ll read()
{
ll s=; bool f=; char ch=' ';
while(!isdigit(ch)) {f|=(ch=='-'); ch=getchar();}
while(isdigit(ch)) {s=(s<<)+(s<<)+(ch^); ch=getchar();}
return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
if(x<) {putchar('-'); x=-x;}
if(x<) {putchar(x+''); return;}
write(x/); putchar((x%)+'');
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('\n')
const int Mod=;
int n;
map<int,int>Map;
int num[],cnt[];
int fac[],invf[];
inline int ksm(int x,int y)
{
int ans=;
while(y)
{
if(y&) ans=1LL*ans*x%Mod;
x=1LL*x*x%Mod;
y>>=;
}return ans;
}
inline int C(int n,int m)
{
int oo;
oo=1LL*fac[n]*invf[m]%Mod*invf[n-m]%Mod;
return oo;
}
int main()
{
freopen("codeforces396A_data.in","r",stdin);
int i,j,k,x;
R(n);
fac[]=invf[]=;
for(i=;i<=;i++) fac[i]=1LL*fac[i-]*i%Mod;
invf[]=ksm(fac[],Mod-);
for(i=;i>=;i--) invf[i]=1LL*invf[i+]*(i+)%Mod;
for(i=;i<=n;i++)
{
R(x);
for(j=;j<=sqrt(x);j++) if(x%j==)
{
int oo=;
while(x%j==) {x/=j; oo++;}
if(!Map[j])
{
Map[j]=++(*num); num[*num]=j; cnt[*num]=oo;
}else cnt[Map[j]]+=oo;
}
if(x>)
{
if(!Map[x])
{
Map[x]=++(*num); num[*num]=x; cnt[*num]=;
}else cnt[Map[x]]++;
}
}
int ans=;
for(i=;i<=*num;i++)
{
ans=1LL*ans*C(cnt[i]+n-,n-)%Mod;
}Wl(ans);
return ;
}
codeforces396A的更多相关文章
- Codeforces396A - On Number of Decompositions into Multipliers
Portal Description 给出\(n(n\leq500)\)个\([1,10^9]\)的数,令\(m=\prod_{i=1}^n a_i\).求有多少个有序排列\(\{a_n\}\),使得 ...
随机推荐
- element-ui默认样式修改
来自 :https://blog.csdn.net/wangguoyu1996/article/details/81394707 侵删 我们在使用element-ui的时候经常会遇到需要修改组件默认样 ...
- iOS应用开发---返回到指定界面
关于ios中 viewcontroller的跳转问题,其中有一种方式是采用navigationController pushViewController 的方法,比如我从主页面跳转到了一级页面,又从一 ...
- Jmeter学习笔记(六)——使用badboy录制脚本
1.下载安装 可以去badboy官网下载地址:http://www.badboy.com.au,如果官网打不开也可以去网上搜索下载. 下载之后点击BadboyInstaller-2.2.5.exe普通 ...
- MYSQL安装与卸载(一)
系统:win10(其他版本系统不在本次内容) MYSQL下载地址:https://dev.mysql.com/downloads/mysql/ MySQL安装主流分为两种:msi,zip Zip:压缩 ...
- 【leetcode】496. Next Greater Element I
原题 You are given two arrays (without duplicates) nums1 and nums2 where nums1's elements are subset o ...
- 2.Git 结构
1.Git 结构: 使用git add命令将写的代码暂存到暂存区:使用git commit命令将暂存区的代码提交到本地库: 2. Git 结构及其代码托管中心: workSpace:工作区(写代码). ...
- Nginx.conf配置文件默认配置块略解
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #erro ...
- 科大讯飞语音识别Demo创建
1.下载官方SDK https://www.xfyun.cn/sdk/dispatcher 2.打开AS,选择import project 3.导入mscV5PlusDemo 4.解决ERROR: ...
- Sublime Text 解决 Unable to download XXX 问题
Sublime Text 安装插件报错: Package Control Unable to download XXX. Please view the console for more detail ...
- Codeforces 750 E New Year and Old Subsequence
E. New Year and Old Subsequence 思路:线段树维护矩阵乘法. 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #p ...