orz jcpwfloi= =
窝本来写了的说。。。被JCPW大爷D惹。。。那就看他的好了!2333
1 /************************************************************** 2 Problem: 3994 3 User: rausen 4 Language: C++ 5 Result: Accepted 6 Time:2664 ms 7 Memory:2320 kb 8 ****************************************************************/ 9 10 #include <cstdio> 11 #include <algorithm> 12 13 using namespace std; 14 typedef long long ll; 15 const int N = 5e4 + 5; 16 const int Maxlen = N * 2 * 7; 17 18 int n, m; 19 int u[N], f[N], d[N], p[N], cnt_p; 20 bool isn_p[N]; 21 ll ans; 22 23 char buf[Maxlen], *c = buf; 24 int Len; 25 26 inline int read() { 27 static int x; 28 x = 0; 29 while (*c < '0' || '9' < *c) ++c; 30 while ('0' <= *c && *c <= '9') 31 x = x * 10 + *c - '0', ++c; 32 return x; 33 } 34 35 inline void get() { 36 int i, j, k; 37 for(u[1] = d[1] = 1, i = 2; i < N; ++i) { 38 if (!isn_p[i]) 39 p[++cnt_p] = i, u[i] = -1, d[i] = 2, f[i] = 1; 40 for (j = 1; j <= cnt_p; ++j) { 41 k = i * p[j]; 42 if (k >= N) break; 43 isn_p[k] = 1; 44 if (i % p[j] == 0) { 45 u[k] = 0, f[k] = f[i] + 1, d[k] = d[i] / f[k] * (f[k] + 1); 46 break; 47 } 48 u[k] = -u[i], d[k] = d[i] * 2, f[k] = 1; 49 } 50 } 51 } 52 53 int main() { 54 Len = fread(c, 1, Maxlen, stdin); 55 buf[Len] = '