摘要: "题目链接" 显然有贪心每次选择最大的两个数来做。 于是暴力地把最大的两个数调整到非负(暴力次数不超过1e5),接下来使用矩阵乘法即可。 $$ \begin{pmatrix} B'\\S'\\T' \end{pmatrix} = \begin{pmatrix} 1&1&0\\ 1&0&0\\ 1&1 阅读全文
posted @ 2019-06-17 22:35 nosta 阅读(208) 评论(0) 推荐(0) 编辑
摘要: "题目链接" 矩阵加速裸题。注意G(x+1)=G(x) A。 cpp // luogu judger enable o2 include define ll long long using namespace std; const int N=5e2+5; const int inf=0x3f3f3 阅读全文
posted @ 2019-06-17 15:50 nosta 阅读(118) 评论(0) 推荐(0) 编辑
摘要: "题目链接" 不妨设$n\le m$ $$ \begin{aligned} ans&=\sum_{i=1}^n\sum_{j=1}^m\varphi(ij)\\ &=\sum_{i=1}^n\sum_{j=1}^m\frac{\varphi(i)\varphi(j)\gcd(i,j)}{\varph 阅读全文
posted @ 2019-06-17 10:49 nosta 阅读(418) 评论(0) 推荐(0) 编辑