当前位置:网站首页>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;
}
边栏推荐
- 2022 construction welder (special type of construction work) special operation certificate examination question bank and online simulation examination
- Financial one account Hong Kong listed: market value of 6.3 billion HK $Ye wangchun said to be Keeping true and true, long - term work
- Simple process of penetration test
- What category does the Internet of things application technology major belong to
- 2022建筑焊工(建筑特殊工种)特种作业证考试题库及在线模拟考试
- UE source code reading [1]--- starting with problems delayed rendering in UE
- 国富氢能冲刺科创板:拟募资20亿 应收账款3.6亿超营收
- 锚点导航小demo
- 常见问题之PHP——Fatal error: Allowed memory size of 314572800 bytes exhausted...
- [buuctf.reverse] 152-154
猜你喜欢

Elfk deployment

IP packet header analysis and static routing

Laravel dompdf exports PDF, and the problem of Chinese garbled code is solved

Redis6 transaction and locking mechanism

研究生可以不用学英语?只要考研英语或六级分数高!

Financial one account Hong Kong listed: market value of 6.3 billion HK $Ye wangchun said to be Keeping true and true, long - term work

Attack and defense world crypto WP

Assembly language - Beginner's introduction
![[machine learning notes] several methods of splitting data into training sets and test sets](/img/f6/eca239bb4b1764a1495ccd9a868ec1.jpg)
[machine learning notes] several methods of splitting data into training sets and test sets

金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功
随机推荐
我为什么支持 BAT 拆掉「AI 研究院」
那些考研后才知道的事
金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功
【云资源】云资源安全管理用什么软件好?为什么?
Kafaka log collection
Current situation, trend and view of neural network Internet of things in the future
Redis6 data type and operation summary
ZABBIX monitoring
[machine learning notes] several methods of splitting data into training sets and test sets
03_Solr之dataimport
Ueditor + PHP enables Alibaba cloud OSS upload
明峰医疗冲刺科创板:年营收3.5亿元 拟募资6.24亿
RK3566添加LED
嵌入式软件架构设计-消息交互
Internal JSON-RPC error. {"code":-32000, "message": "execution reverted"} solve the error
Kotlin collaboration uses coroutinecontext to implement the retry logic after a network request fails
神经网络物联网未来现状和趋势及看法
Detailed explanation of SSH password free login
Comparison of several distributed databases
Zibll theme external chain redirection go page beautification tutorial