Factors of Factorial
问题 G: Factors of Factorial
时间限制: 1 Sec 内存限制: 128 MB
提交: 45 解决: 25
[提交][状态][讨论版][命题人:admin]
题目描述
You are given an integer N. Find the number of the positive divisors of N!, modulo 109+7.
Constraints
1≤N≤103
输入
The input is given from Standard Input in the following format:
N
输出
Print the number of the positive divisors of N!, modulo 109+7.
样例输入
3
样例输出
4
提示
There are four divisors of 3! =6: 1, 2, 3 and 6. Thus, the output should be 4.
求n的阶乘的因子个数
将这个数表示成质因子的乘积
n!= 2^a + 3^b + 5^c + 7^d……
因子个数就是(a+1)*(b+1)*(c+1)*……
即对2来说可以选择0到a个
代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
const int INF=1e5+100;
int f[INF];
int main()
{int n,a;cin>>n;memset(f,0,sizeof(f));for(int i=2; i<=n; i++){a=i;for(int j=2; j<=a; j++){while(a%j==0){f[j]++;a=a/j;}}if(a!=1) f[a]++;}ll ans=1;for(int i=1; i<=n; i++){if(f[i]!=0) ans=(ans*(f[i]+1))%MOD;}cout<<ans%MOD<<endl;return 0;
}
Factors of Factorial相关推荐
- C - Factors of Factorial(数学)
C - Factors of Factorial (atcoder.jp) n!中约数的个数 #include <iostream> #include <vector> #in ...
- Factors of Factorial AtCoder - 2286 (N的阶乘的因子个数)(数论)
Problem Statement You are given an integer N. Find the number of the positive divisors of N!, modulo ...
- Factors of Factorial(AtCoder-2286)
Problem Description You are given an integer N. Find the number of the positive divisors of N!, modu ...
- oracle一个汉字三个字节,1个汉字在UTF-8编码占3个字节
8. 实例 下面,举一个实例. 打开"记事本"程序Notepad.exe,新建一个文本文件,内容就是一个"严"字,依次采用ANSI,Unicode,Unicod ...
- time series 时间序列 | fractional factorial design 部分要因试验设计
作业: 1) A plot of data from a time series, which shows a cyclical pattern – please show a time series ...
- UVA160 Factors and Factorials【筛选法】
The factorial of a number N (written N!) is defined as the product of all the integers from 1 to N. ...
- 172. Factorial Trailing Zeroes
/**172. Factorial Trailing Zeroes *2016-6-4 by Mingyang* 首先别忘了什么是factorial,就是阶乘.那么很容易想到需要统计* (2,5)对的 ...
- 1096 Consecutive Factors
1. 对于题目描述中 list the smallest sequence of the consecutive factors 正确理解是:如果有多组连续因子,输出开头因子最小的那个序列(一开始理解 ...
- Error in Math.factor() : ‘sqrt’ not meaningful for factors
Error in Math.factor() : 'sqrt' not meaningful for factors 目录 Error in Math.factor() : 'sqrt' not me ...
最新文章
- Octave Convolution卷积
- Ubuntu 12.04 64位上安装Wine QQ2013
- 如何居中“位置:绝对”元素
- ResDepot CRC码
- MATLAB问题解决方案- Matlab出现报错:​‘***‘不是内部或外部命令,也不是可运行的程序或批处理文件
- XSS编码问题以及绕过
- 2000年不算在21世纪
- C++primer第15章节详解面向对象程序设计
- kotlin编译失败_Kotlin使用GraalVM开发原生命令行应用
- 瓦片经纬度及行列号转换_ArcGIS根据最大最小坐标换算瓦片行列号
- Idea中maven项目中导入本地jar包
- Hibernate笔记7--JPA CRUD
- 佳肴_纪中1420_dfs
- Android刷新当前页面
- Mongodb在Ubuntu下的安装
- CAN:CANape使用Function处理数据
- springboot毕业设计管理系统(带论文)
- 解决High bias 和High variance 的方法
- 0806 07 08 09 12上午数据库
- busboy文件上传遇到的坑,已解决