# 【Violet 5】【BZOJ2721】樱花

Description

Input

Output

Sample Input
3
Sample Output
9
HINT

Source

interviewstreet–EQUATIONS

SD2015省队集训Week1的测试题

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define MAXN 1000010
#define P 1000000007
using namespace std;
int n;
long long ans=1;
int prime[MAXN],top,fac[MAXN];
bool not_prime[MAXN];
int cnt[MAXN];
void check_prime()
{
for (int i=2;i<=n;i++)
{
if (!not_prime[i])  prime[++top]=i,fac[i]=top;
for (int j=1;j<=top&&i*prime[j]<=n;j++)
{
not_prime[i*prime[j]]=1;fac[i*prime[j]]=j;
if (i%prime[j]==0)  break;
}
}
}
void calc(int x)
{
while (x!=1)    cnt[fac[x]]++,x/=prime[fac[x]];
}
int main()
{
scanf("%d",&n);
check_prime();
for (int i=1;i<=n;i++)  calc(i);
for (int i=1;i<=top;i++)    ans=ans*((2*cnt[i]+1)%P)%P;
cout<<ans<<endl;
}

#### 2721: [Violet 5]樱花|约数个数

2016-03-20 07:44:56

#### [bzoj2721][Violet 5]樱花

2017-09-22 09:50:19

#### [BZOJ2721][Violet 5]樱花（数论）

2017-02-28 21:45:16

#### 【bzoj2721】【Violet 5】樱花【数论】

2015-10-06 18:34:23

#### BZOJ 2721 [Violet 5]樱花

2016-10-02 16:45:31

#### BZOJ2721 樱花 [线性筛]

2017-09-22 08:54:33

#### [BZOJ2721]樱花 阶乘标准分解式

2017-10-19 22:35:22

#### BZOJ 2721: [Violet 5]樱花

2017-03-29 13:19:58

#### 质数--bzoj2721樱花

2018-06-01 00:09:38

#### Bzoj 2721 [Violet 5]樱花 [数论]

2017-09-22 09:51:29