摘要:
显然题目要我们求 $2\sum_{i=1}^N \sum_{j=1}^M (i,j) NM$ 即 $2\sum_{i=1}^{\min(N,M)} \phi(i)\lfloor \frac{N}{i} \rfloor \lfloor \frac{M}{i} \rfloor NM$ 线筛+前缀和+整除 阅读全文
摘要:
树状数组维护前缀最大值+扫描线DP cpp include"cstdio" include"cstring" include"iostream" include"algorithm" using namespace std; const int MAXN=1e5+5; int n,m,c,maxn; 阅读全文