摘要: 题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2190 看到这道题首先想到了NOI2010的能量采集,这不就是赤裸裸的弱化版吗?直接上莫比乌斯反演就行了。 令$f(d)=\sum_{i=1}^n\sum_{j=1}^n[gcd(i,j)== 阅读全文
posted @ 2017-10-03 21:38 halfrot 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1083 由kruskal算法原理可知,我们对一张无向图做普通的最小生成树,连上的最后一条边就是答案。 阅读全文
posted @ 2017-10-03 19:52 halfrot 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2330 类似于题目中这种含有不等式关系,我们可以建立差分约束系统来跑最长路或最短路。 对于一个不等式$X_1-X_2>=a$我们可以看成是$X_1>=X_2+a$,把$X_1$和$X_2$看成 阅读全文
posted @ 2017-10-03 18:52 halfrot 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1257 题目所求为$$Ans=\sum_{i=1}^nk%i$$ 将其简单变形一下$$Ans=\sum_{i=1}^nk-\lfloor\frac{k}{i}\rfloor*i$$ $$Ans 阅读全文
posted @ 2017-10-03 16:08 halfrot 阅读(138) 评论(0) 推荐(0) 编辑