摘要: 套路:对于这种计算所有情况价值和的问题计算每一个点对答案的贡献. 我们发现,位置 $i$ 能对答案贡献 $val[i]$,当且仅当 $i$ 是前缀最大值,且 $i$ 不等于序列中最大元素. 我们不妨考虑哪些点大于等于 $val[i]$ 的位置,那么 $val[i]$ 能产生贡献的话显然要求 $i$ 阅读全文
posted @ 2020-01-10 15:34 EM-LGH 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 这个还是比较简单的. 将 $x$ 质因数分解,然后依次考虑每个质因子的贡献就行了,贡献是一个组合. code: #include <cstdio> #include <algorithm> #define N 2000006 #define ll long long #define mod 1000 阅读全文
posted @ 2020-01-10 14:31 EM-LGH 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 这个题的思路非常神啊,感觉不太好理解... code: #include <cstdio> #include <algorithm> #include <cstring> #include <string> #define N 100006 #define ll long long using na 阅读全文
posted @ 2020-01-10 13:49 EM-LGH 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 复习一下线性基 ~ code: #include <cmath> #include <vector> #include <cstdio> #include <string> #include <cstring> #include <algorithm> #define N 500008 #defin 阅读全文
posted @ 2020-01-10 10:53 EM-LGH 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一颗树,要求每个点的点权范围是 $[1,D]$ 且权值不大于父亲,求方案数. 显然,即使 $D$ 再大,$n$ 个点也最多只会取到 $n$ 个值. 令 $f[x][i]$ 表示以 $x$ 为根的子树中点 $x$ 取到权值 $i$ 的方案数. 令 $s[x][i]$ 表示 $f[x][i]$ 阅读全文
posted @ 2020-01-10 09:32 EM-LGH 阅读(180) 评论(0) 推荐(0) 编辑