摘要: 题面:https://www.luogu.org/problem/P3469 cpp 本题算答案的时候是很有技巧的,设u为割点,先算一遍以u子节点v为根的子树对外面所有点的答案,然后再把u和所有v作为一个整体,算以u为根的子树对外面的答案. 注意:这里的割点u要单独算. Code: include 阅读全文
posted @ 2019-10-09 20:30 prestige 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 题面:https://www.luogu.org/problem/P5058 阅读全文
posted @ 2019-10-09 19:32 prestige 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题面:https://www.luogu.org/problem/P2220 cpp 如题,这真是一道简单题. 很容易想到如果没有限制条件ans=(1+2+...+n) (1+2+...+n) ... (1+2+...+n) 那么如果有限制条件的话直接在括号里减去相应的限制条件即可. Code: i 阅读全文
posted @ 2019-10-09 12:37 prestige 阅读(104) 评论(0) 推荐(0) 编辑