当前位置:网站首页>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;
}
边栏推荐
- 神经网络物联网未来现状和趋势及看法
- SAS接口有什么优势特点
- Laravel - view (new and output views)
- UE source code reading [1]--- starting with problems delayed rendering in UE
- 03_Solr之dataimport
- What is information security? What is included? What is the difference with network security?
- Kotlin collaboration uses coroutinecontext to implement the retry logic after a network request fails
- [machine learning notes] several methods of splitting data into training sets and test sets
- Embedded software architecture design - message interaction
- Scientific running robot pancakeswap clip robot latest detailed tutorial
猜你喜欢
Why do I support bat to dismantle "AI research institute"
Can graduate students not learn English? As long as the score of postgraduate entrance examination English or CET-6 is high!
Those things I didn't know until I took the postgraduate entrance examination
如何将 DevSecOps 引入企业?
Kotlin collaboration uses coroutinecontext to implement the retry logic after a network request fails
About the problem and solution of 403 error in wampserver
ZABBIX monitoring
国富氢能冲刺科创板:拟募资20亿 应收账款3.6亿超营收
Laravel dompdf exports PDF, and the problem of Chinese garbled code is solved
[South China University of technology] information sharing of postgraduate entrance examination and re examination
随机推荐
How to deal with the Yellow Icon during the installation of wampserver
What is the future development trend of neural network Internet of things
Convolutional Neural Networks简述
tidb-dm报警DM_sync_process_exists_with_error排查
Kotlin collaboration uses coroutinecontext to implement the retry logic after a network request fails
瑞能实业IPO被终止:年营收4.47亿 曾拟募资3.76亿
01 、Solr7.3.1 在Win10平台下使用jetty的部署及配置
锚点导航小demo
Selenium crawls Baidu pictures
RK3566添加LED
About the problem and solution of 403 error in wampserver
嵌入式软件架构设计-消息交互
广发期货排名多少?网上办理广发期货开户安全可靠吗?
Internal JSON-RPC error. {"code":-32000, "message": "execution reverted"} solve the error
Login interface code
[buuctf.reverse] 152-154
Deep copy is hard
Why do I support bat to dismantle "AI research institute"
Redis6 transaction and locking mechanism
研究生可以不用学英语?只要考研英语或六级分数高!