Description
Input
Output
Sample Input
Sample Output
HINT
题解:显然y>n!;
设y=n!+a;
代入原式子可以得到x=((n!)^2)/a+n!;
然后答案就是(n!)^2的因子个数了.
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#define P 1000000007
#define N 1000010
using namespace std;
int n,m,p[N];
long long ans(1),temp;
bool f[N];
void pre(int x){
memset(f,1,sizeof(f));
for (int i=2;i<=n;i++){
if (f[i]) p[++p[0]]=i;
for (int j=1;j<=p[0]&&p[j]*i<=n;j++){
f[i*p[j]]=false;
if (i%p[j]==0) break;
}
}
}
int main(){
scanf("%d",&n);pre(n);
for (int i=1;i<=p[0];i++){
temp=0;m=n;
while (m){temp+=m/p[i];m/=p[i];}
temp=(temp<<1|1)%P;(ans*=temp)%=P;
}
cout<<ans<<endl;
}