问题 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相关推荐

  1. C - Factors of Factorial(数学)

    C - Factors of Factorial (atcoder.jp) n!中约数的个数 #include <iostream> #include <vector> #in ...

  2. Factors of Factorial AtCoder - 2286 (N的阶乘的因子个数)(数论)

    Problem Statement You are given an integer N. Find the number of the positive divisors of N!, modulo ...

  3. Factors of Factorial(AtCoder-2286)

    Problem Description You are given an integer N. Find the number of the positive divisors of N!, modu ...

  4. oracle一个汉字三个字节,1个汉字在UTF-8编码占3个字节

    8. 实例 下面,举一个实例. 打开"记事本"程序Notepad.exe,新建一个文本文件,内容就是一个"严"字,依次采用ANSI,Unicode,Unicod ...

  5. time series 时间序列 | fractional factorial design 部分要因试验设计

    作业: 1) A plot of data from a time series, which shows a cyclical pattern – please show a time series ...

  6. 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. ...

  7. 172. Factorial Trailing Zeroes

    /**172. Factorial Trailing Zeroes *2016-6-4 by Mingyang* 首先别忘了什么是factorial,就是阶乘.那么很容易想到需要统计* (2,5)对的 ...

  8. 1096 Consecutive Factors

    1. 对于题目描述中 list the smallest sequence of the consecutive factors 正确理解是:如果有多组连续因子,输出开头因子最小的那个序列(一开始理解 ...

  9. 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 ...

最新文章

  1. Octave Convolution卷积
  2. Ubuntu 12.04 64位上安装Wine QQ2013
  3. 如何居中“位置:绝对”元素
  4. ResDepot CRC码
  5. MATLAB问题解决方案- Matlab出现报错:​‘***‘不是内部或外部命令,也不是可运行的程序或批处理文件
  6. XSS编码问题以及绕过
  7. 2000年不算在21世纪
  8. C++primer第15章节详解面向对象程序设计
  9. kotlin编译失败_Kotlin使用GraalVM开发原生命令行应用
  10. 瓦片经纬度及行列号转换_ArcGIS根据最大最小坐标换算瓦片行列号
  11. Idea中maven项目中导入本地jar包
  12. Hibernate笔记7--JPA CRUD
  13. 佳肴_纪中1420_dfs
  14. Android刷新当前页面
  15. Mongodb在Ubuntu下的安装
  16. CAN:CANape使用Function处理数据
  17. springboot毕业设计管理系统(带论文)
  18. 解决High bias 和High variance 的方法
  19. 0806 07 08 09 12上午数据库
  20. busboy文件上传遇到的坑,已解决

热门文章

  1. 深度学习:权重衰减(weight decay)与学习率衰减(learning rate decay)
  2. weight decay 的矩阵描述
  3. python爬取万方数据库,爬虫获取 js 动态数据 (万方数据库文献下载)
  4. 程序员的三大优点:懒惰、急躁和傲慢
  5. HashMap 扩容阈值为什么是0.75
  6. @Compoment
  7. three.js 物体轮廓高亮
  8. Cocos精品《热血传奇》|五千个日夜 同一个传奇
  9. DCC:Deep continuous clustering
  10. Android性能优化方法论