上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页
摘要: \(\text{Solution}\) 容易发现答案为 \(\sum_{x = 1}^n\sum_{y = 1}^m[\gcd(x,y) = 1][\gcd(y,k) = 1]\) \(=\sum_{x = 1}^n\sum_{y = 1}^m\sum_{d|\gcd(x,y)}\mu(d)\sum 阅读全文
posted @ 2022-03-09 21:32 RiverSheep 阅读(46) 评论(0) 推荐(0)
摘要: \(\text{Code}\) #include<cstdio> #include<tr1/unordered_map> #define LL long long using namespace std; const int M = 5e6; int vis[M + 5],p[M + 5],tot, 阅读全文
posted @ 2022-03-09 19:43 RiverSheep 阅读(38) 评论(0) 推荐(0)
摘要: \(\text{Solution}\) 考虑眼切,你就$AC$了 对于求本质不同的方案数,显然可以用$Burnside$引理。 接着$DP$求方案数,对于头尾的限制,可以在最后在加一个和头部一样的珠子。用矩阵优化即可。 \(\text{Code}\) #include<cstdio> #includ 阅读全文
posted @ 2022-03-08 20:16 RiverSheep 阅读(37) 评论(0) 推荐(0)
摘要: \(Code\) #include<cstdio> #include<cstring> #include<algorithm> #define LL long long using namespace std; const int N = 2e7 + 5; LL z[N],p[N]; char a[ 阅读全文
posted @ 2022-02-22 12:51 RiverSheep 阅读(32) 评论(0) 推荐(0)
摘要: \(Code\) #include<cstdio> #include<cstring> #include<algorithm> #define LL long long using namespace std; const int N = 2e7 + 5; LL z[N],p[N]; char a[ 阅读全文
posted @ 2022-02-22 12:48 RiverSheep 阅读(35) 评论(0) 推荐(0)
摘要: \(Solution\) 一道比较模板的线性基,设$a$为线性基中元素的个数,那么答为 \(\sum_{i = 0}^a \binom{a}{i} = \sum_{i = 0}^a \binom{a}{i}*1^i*1^{a - i} = (1 + 1)^a = 2^a\) 因为从线性基中取任意个数 阅读全文
posted @ 2022-02-10 21:57 RiverSheep 阅读(33) 评论(0) 推荐(0)
摘要: \(Solution\) 考虑把一个豆豆看成一条边,那限制流量为$1$,费用为$1$,豆豆即会被吃一次。拆点,两点之间连一条有贡献的边和无贡献的边,可做到让两条路径重合后不会多产生贡献。路线不可以相交可以通过连边的方式解决,但我们发现边数太多了。考虑我们连的一些无用的边,形如一个钝角三角形,明显有边 阅读全文
posted @ 2022-01-26 20:07 RiverSheep 阅读(83) 评论(0) 推荐(0)
摘要: \(Solution\) 这是一道一个人覆盖一个区间的问题,对于人,考虑把他看成一流量,对于$a_i$的限制,相当于把$a_i$的流量放在了$i$点上,所以$S$和$1$号点连$inf$,$n + 1$号点和$T$连$inf$,$i$和$i + 1$连$inf - a_i$。对于留下的流量一定要产生 阅读全文
posted @ 2022-01-25 20:12 RiverSheep 阅读(31) 评论(0) 推荐(0)
摘要: #include <cstdio> #include <iostream> #define LL long long #define RE register #define IN inline using namespace std; const int N = 5e5 + 5; int h[N < 阅读全文
posted @ 2022-01-24 16:15 RiverSheep 阅读(64) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<algorithm> using namespace std; const int N = 1e5 + 5; int dfn[N],low[N],dfc,f[N],g[N],n,m,K,L,cnt,tot,h[N]; struct edge{ in 阅读全文
posted @ 2022-01-24 16:13 RiverSheep 阅读(37) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页