Problem Statement The least common multiple (denoted "lcm") of a non-empty sequence of positive integers is the smallest positive integer that is divisible by each of them. For example, lcm(2)=2, lcm(4,6)=12, and lcm(1,2,3,4,5)=60. Alice had a p…
problem1 link $N+1$到$M$ 之间的数字要包含所有1到$N$之间出现的质因子的最高幂即可. problem2 link 从第一个节点到第$N$个节点依次考虑.对于第$i$个节点来说,其颜色为$j$时,可以选择与前面的连边或者不连边,方案数为$1+(i-1)+g(i-1,j)$.其中$g(x,y)$ 表示前$x$个节点中,颜色为$y$ 的节点的个数 所以节点$i$的方案数为$f(i)=\sum_{j=1}^{K}(1+i-1-g(i-1,j))=K*i-\sum_{j=1}^{K…
题意 [题目链接]这怎么发链接啊..... Sol 枚举一个断点,然后类似于LIS一样dp一波 这个边界条件有点迷啊..fst了两遍... #include<bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10, INF = 1e9 + 7; inline int read() { char c = getchar(); int x = 0, f = 1; while(c < '0' || c > '9') {i…