# Digital table for "Bzoj 2154" crash

Source: Internet
Author: User

The staff,,, to seek the prefix and the time \$ixi\$ is int, and then when the \$i=10^7\$ will be loved to explode int,,, after the shooting of an afternoon to find this problem,,, the last enumeration with the variables are all forcibly plus a long long only a drop

`#include <cstdio> #include <cstring> #include <algorithm> #define READ (x) X=getint () using namespace Std;typedef long Long ll;const int p = 20101009;const int N = 1E7 + 3;int getint () {int k = 0, fh = 1; char c = GetChar (); for (; c < ' 0 ' | | c > ' 9 '; c = GetChar ()) if (c = = '-') FH = -1;for (; c >= ' 0 ' && C <= ' 9 '; c = GetChar ( ) K = k * + C-' 0 '; return k * FH;  BOOL Np[n];int Prime[n], mu[n], s[n];void shai (int N) {mu[1] = 1; s[1] = 1; int num = 0;for (int i = 2; I <= N; ++i) {if (!np[i]) {Mu[i] = -1;prime[++num] = i;} for (int j = 1; j <= Num; ++j) {int t = prime[j] * I;IF (T > N) break;np[t] = 1;if (i% prime[j] = 0) {Mu[t] = 0; BR Eak;} MU[T] =-mu[i];} S[i] = (S[i-1] + (1LL * I * i * mu[i])% p)% p;}} ll sum (ll X, ll y) {return ((((x * (x + 1)/2)% P) * ((Y * (y + 1)/2)% p))% p;} ll F (ll X, ll y) {ll re = 0;for (int i = 1, la = 1; i <= x; i = la + 1) {la = min (x/(x/i), Y/(y/i)); re = (re + ( S[la]-s[i-1]) * SUM (x/i, y/i)% p)% P;} return re;} int main () {int n, m;read (n); Read (m), if (n > M) swap (n, m); Shai (n); LL ret = 0;for (ll d = 1, la = 1; d <= n; d = la + 1) {la = min (n/(n/d), M/(M/D)); ret = (ret + (d + LA) * (LA- D + 1)/2 P * F (n/d, m/d)% p)% p;} printf ("%lld", (ret + p)% p); return 0;}`

I don't know what to say ...

Digital table for "Bzoj 2154" crash

Related Keywords:

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.