Description
Input
Output
Sample Input Sample Output HINT
The formula problem of the egg ache ... According to test instructions 1/x+1/y=1/z, make y=z+d, and then
1/x+1/(z+d) =1/z
(x+z+d)/(XZ+XD) =1/z
Xz+z^2+dz=xz+xd
Z^2+dz=xd
X=z^2/d+z
Obviously x is a positive integer depending on the D can divide z^2
Each d corresponds to a unique x, so the answer is the approximate number of z^2.
(n!) The approximate number of ^2
#include <cstdio> #include <iostream> #include <cstring> #include <cstdlib> #include < algorithm> #include <cmath> #include <queue> #include <deque> #include <set> #include <map > #include <ctime> #define LL long long#define INF 0x7ffffff#define pa pair<int,int> #define MOD 1000000007# Define MX 1000000using namespace Std;inline ll read () {ll x=0,f=1;char Ch=getchar (); while (ch< ' 0 ' | | Ch> ' 9 ') {if (ch== '-') F=-1;ch=getchar ();} while (ch>= ' 0 ' &&ch<= ' 9 ') {x=x*10+ch-' 0 '; Ch=getchar ();} return x*f;} inline void Write (LL a) {if (a<0) {printf ("-"); a=-a;} if (a>=10) write (A/10); Putchar (a%10+ ' 0 ');} inline void Writeln (LL a) {write (a);p rintf ("\ n");} BOOL PRIME[MX+10]; LL rep[mx+10];int N; LL ans=1;inline void Shai () {memset (prime,1,sizeof (prime)); prime[1]=0; for (int i=2;i<=n;i++) if (Prime[i]) {LL res=i; while (LL) n/res>0 {rep[i]+= (ll) n/res; Res*=i; } for (int j=2*i;j<=n;j+=i) prime[j]=0; }}int Main () {n=read (); Shai (); if (n==1) {printf ("1\n"); return 0; } for (int i=1;i<=n;i++) if (Prime[i]) {ans=ans* (2*rep[i]+1)%mod; } printf ("%lld\n", ans);}
bzoj2721 [Violet 5] cherry blossoms