bzoj2721 [Violet 5] cherry blossoms

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.