First kneel a topic background qaq
Obviously < Span class= "Mrow" id= "mathjax-span-974" > x , Y > n ! , and then you can set y=n! + d
The original formula can be simplified into x= n! 2 d +N!
So the number of solutions is n! The number of factors, and then the linear sieve casually.
#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <queue>#include <vector>#include <set>#include <map>#include <iostream>#include <algorithm>#define N 1000008#define MOD 1000000007using namespace STD;intSC () {intI=0, f=1;CharC=getchar (); while(c>' 9 '|| c<' 0 '){if(c=='-') f=-1; C=getchar ();} while(c>=' 0 '&&c<=' 9 ') i=i*Ten+c-' 0 ', C=getchar ();returnI*f;}Long Longans=1;intLo[n],low[n],a[n],prime[n],s[n],top;intSum[n],n;voidPreintN) { for(intI=2; i<=n;i++) {if(!a[i]) s[prime[++top]=low[i]=lo[i]=i]=1; for(intj=1;p rime[j]*i<=n;j++) {a[i*prime[j]]=1; LO[I*PRIME[J]]=PRIME[J];if(i%prime[j]==0) {Low[i*prime[j]]=low[i]*prime[j]; s[i*prime[j]]=s[i]+1; Break; } Low[i*prime[j]]=prime[j]; s[i*prime[j]]=1; } }}intMain () {Pre (N=SC ()); for(intI=2; i<=n;i++) {intNow=i; while(now!=1) sum[lo[now]]+=2*s[now],now/=low[now]; } for(intI=1; i<=n;i++) ans=ans* (sum[i]+1)%mod;cout<<ans;return 0;}
2721: [Violet 5] Cherry blossom | About a few numbers