当前位置:网站首页>C - Divisors of the Divisors of An Integer Gym - 102040C
C - Divisors of the Divisors of An Integer Gym - 102040C
2022-07-05 14:01:00 【beyond+myself】
Topic link
The question : Is o n! The number of factors in the factor
Answer key :
①:n! The number of a factor in is n/x Accumulation .
prove : In fact, it is one layer at a time , That is, each removal can be divided into 1 individual 3 Of , Two in turn 3 Of , Three 3 The number of , Finally, you can get 3 The number of , There's no need to
to be divisible by , Because it's a factorial , So even if it can't be divisible , It can also be divided by smaller numbers in the array .
Let's give you an example :
1234567 We find what we finally get 2 The number of , for the first time We found that 2 4 6 Divisibility , After division, it becomes 1 2 3 then 7/2=3,ans+=3, then 2 Still divisible , And then it became 1, then 3/2=1, You can't divide the rest , So we can find this rule .
②: Suppose we can turn the result of factorial into something similar to 2 ^ a * 3 ^ b * 5 ^ c In this way , We can get the result —— yes (a+1)*(a+2) / 2 * (b+1) * (b+2) / 2 *(c+1) * (c+2) / 2;
prove : After we write them in the above form , In fact, the factor is easy to find , If you let me find the number of factors , That's all for this question , But the question requires the number of factors , So we can't finish here , The number of factors is —— We just ask
A prime unit , For example :3 ^ 0 The number of factors of is 1 individual ,3 ^ 1 Are the two ,3 ^ a The number of factors ( 3 ^ 0 ~ 3 ^ a) common a+1 individual therefore We add them up to (a+1) * (a+2)/2 such Multiply all of them , That is, the number of cases similar to permutation and combination , When all numbers are selected 0 Inferior time , That is to say 1.
Here is AC Code :
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
#define int long long
const int N=1e6+10,mod=1e7+7;
int prime[N];
bool st[N];
int cnt[N];
int cou;
void is_prime(int n)
{
int i,j;
for(i=2;i<=n;i++)
{
if(!st[i])
{
prime[cou++]=i;
for(j=i+i;j<=n;j+=i) st[j]=true;
}
}
}
signed main()
{
is_prime(1e6);
int n;
while(cin>>n&&n)
{
memset(cnt,0,sizeof(cnt));
for(int i=0;prime[i]<=n;i++)
{
cnt[i]=0;
int tmp=n;
while(tmp)
{
cnt[i]+=tmp/prime[i];
tmp/=prime[i];
}
}
int ans=1;
for(int i=0;prime[i]<=n;i++)
{
if(cnt[i]>0)
{
ans=(ans%mod*((cnt[i]+1)*(cnt[i]+2)/2)%mod)%mod;
}
}
printf("%lld\n",ans);
}
return 0;
}
边栏推荐
- Anchor navigation demo
- RK3566添加LED
- Solution to the prompt of could not close zip file during phpword use
- [machine learning notes] how to solve over fitting and under fitting
- What is the ranking of GF futures? Is it safe and reliable to open an account for GF futures online?
- 2022 construction welder (special type of construction work) special operation certificate examination question bank and online simulation examination
- Zibll theme external chain redirection go page beautification tutorial
- 鏈錶(簡單)
- Assembly language - Beginner's introduction
- 让秒杀狂欢更从容:大促背后的数据库(下篇)
猜你喜欢

瑞能实业IPO被终止:年营收4.47亿 曾拟募资3.76亿

TiFlash 源码解读(四) | TiFlash DDL 模块设计及实现分析

How to deal with the Yellow Icon during the installation of wampserver

Ordering system based on wechat applet
![UE source code reading [1]--- starting with problems delayed rendering in UE](/img/fa/f33242b01e4da973fa36c2c6f23db6.png)
UE source code reading [1]--- starting with problems delayed rendering in UE

Xampp configuring multiple items
Jetpack compose introduction to mastery
![UE源码阅读[1]---由问题入手UE中的延迟渲染](/img/fa/f33242b01e4da973fa36c2c6f23db6.png)
UE源码阅读[1]---由问题入手UE中的延迟渲染

What category does the Internet of things application technology major belong to

Anchor navigation demo
随机推荐
判断变量是否为数组
[cloud resources] what software is good for cloud resource security management? Why?
What category does the Internet of things application technology major belong to
Implementation process of WSDL and soap calls under PHP5
物联网应用技术专业是属于什么类
如何将 DevSecOps 引入企业?
TiFlash 源码解读(四) | TiFlash DDL 模块设计及实现分析
神经网络物联网未来现状和趋势及看法
Linked list (simple)
让秒杀狂欢更从容:大促背后的数据库(下篇)
如何把大的‘tar‘存档文件分割成特定大小的多个文件
嵌入式软件架构设计-消息交互
Self built shooting range 2022
Login interface code
[South China University of technology] information sharing of postgraduate entrance examination and re examination
明峰医疗冲刺科创板:年营收3.5亿元 拟募资6.24亿
Google EventBus 使用详解
Jetpack Compose入门到精通
Simple process of penetration test
2022年机修钳工(高级)考试题模拟考试题库模拟考试平台操作