HDU 6340 Problem I. Delightful Formulas(伯努利数 + 积性函数反演)

Problem I. Delightful Formulas

大概就是照着题解抄了一遍吧,这道题太神仙了……

ai=ik,si=∑j=1iajcalc∑i=1nsi[gcd⁡(i,n)=1]∑d∣nμ(d)∑i=1ndsida_i = i ^ k, s_i = \sum_{j = 1} ^{i} a_j\\ calc\ \sum_{i = 1} ^{n} s_i[\gcd(i, n) = 1]\\ \sum_{d \mid n} \mu(d) \sum_{i = 1} ^{\frac{n}{d}} s_{id}\\ ai=ik,si=j=1iajcalc i=1nsi[gcd(i,n)=1]dnμ(d)i=1dnsid

伯努利数对自然幂次求和有:
Sk(n)=∑i=0nik=1k+1∑i=0kCk+1iBi(n+1)k+i−1不难发现其为一个k+1阶多项式,设Sk(x)=∑i=0k+1aixiSk(n)=1k+1∑i=1k+1Ck+1iBk+1−i(n+1)i1k+1∑i=0k+1Ck+1iBk+1−i(n+1)i−1k+1Bk+11k+1∑i=0k+1Ck+1iBk+1−i∑j=0iCijnj−1k+1Bk+11k+1∑j=0k+1nj∑i=jk+1Ck+1iBk+1−iCij−1k+1Bk+1S_k(n) = \sum_{i = 0} ^{n} i ^ k = \frac{1}{k + 1} \sum_{i = 0} ^{k}C_{k + 1} ^{i} B_i (n + 1) ^{k + i - 1}\\ 不难发现其为一个k + 1阶多项式,设S_k(x) = \sum_{i = 0} ^{k + 1} a_i x ^{i}\\ S_k(n) = \frac{1}{k + 1} \sum_{i = 1} ^{k + 1} C_{k + 1} ^{i} B_{k + 1 - i} (n + 1) ^{i}\\ \frac{1}{k + 1} \sum_{i = 0} ^{k + 1} C_{k + 1} ^{i} B_{k + 1 - i} (n + 1) ^{i} - \frac{1}{k + 1} B_{k + 1}\\ \frac{1}{k + 1} \sum_{i = 0} ^{k + 1} C_{k + 1} ^{i} B_{k + 1 - i} \sum_{j = 0} ^{i} C_{i} ^{j} n ^j - \frac{1}{k + 1} B_{k + 1}\\ \frac{1}{k + 1} \sum_{j = 0} ^{k + 1} n ^ j \sum_{i = j} ^{k + 1} C_{k + 1} ^{i} B_{k + 1 - i} C_i ^ j - \frac{1}{k + 1} B_{k + 1}\\ Sk(n)=i=0nik=k+11i=0kCk+1iBi(n+1)k+i1k+1Sk(x)=i=0k+1aixiSk(n)=k+11i=1k+1Ck+1iBk+1i(n+1)ik+11i=0k+1Ck+1iBk+1i(n+1)ik+11Bk+1k+11i=0k+1Ck+1iBk+1ij=0iCijnjk+11Bk+1k+11j=0k+1nji=jk+1Ck+1iBk+1iCijk+11Bk+1
a0=0,j≥1a_0 = 0, j \geq 1a0=0,j1时有:
1k+1∑i=jk+1Ck+1iBk+1−iCij1k+1∑i=0k+1−jck+1iBiCk+1−ij1k+1∑i=0k+1−j(k+1)!i!(k+1−i)!(k+1−i)!j!(k+1−i−j)!Bi1k+1∑i=0k+1−j(k+1)!(k+1−j)!i!(k+1−j)!j!(k+1−i−j)!Bi1k+1∑i=0k+1−jCk+1−jiCk+1jBi1k+1Ck+1j∑i=0k+1−jCk+1−jiBi1k+1Ck+1j(∑i=0k−jCk−j+1iBi+Bk+1−j)有∑i=0kCk+1iBi=0,k≥1上式子为1k+1Ck+1jBk+1−j\frac{1}{k + 1} \sum_{i = j} ^{k + 1} C_{k + 1} ^{i} B_{k + 1 - i} C_{i} ^ {j}\\ \frac{1}{k + 1} \sum_{i = 0} ^{k + 1 - j}c_{k + 1} ^{i} B_{i} C_{k + 1 - i} ^{j}\\ \frac{1}{k + 1} \sum_{i = 0} ^{k + 1 - j} \frac{(k + 1)!}{i!(k + 1 - i)!} \frac{(k + 1 - i)!}{j! (k + 1 -i - j)!} B_i\\ \frac{1}{k + 1} \sum_{i = 0} ^{k + 1 - j} \frac{(k + 1)! (k + 1 - j)!}{i!(k + 1 - j)!j!(k + 1 - i - j)!} B_i\\ \frac{1}{k + 1} \sum_{i = 0} ^{k + 1 - j} C_{k + 1 - j} ^{i} C_{k + 1} ^{j} B_i\\ \frac{1}{k + 1} C_{k + 1} ^{j} \sum_{i = 0} ^{k + 1 - j} C_{k + 1 - j} ^{i} B_i\\ \frac{1}{k + 1} C_{k + 1} ^{j}\left(\sum_{i = 0} ^{k - j} C_{k - j + 1} ^{i} B_i + B_{k + 1 - j}\right)\\ 有\sum_{i = 0} ^{k} C_{k + 1} ^{i} B_i = 0, k \geq 1\\ 上式子为\frac{1}{k + 1} C_{k + 1} ^{j} B_{k + 1 - j}\\ k+11i=jk+1Ck+1iBk+1iCijk+11i=0k+1jck+1iBiCk+1ijk+11i=0k+1ji!(k+1i)!(k+1)!j!(k+1ij)!(k+1i)!Bik+11i=0k+1ji!(k+1j)!j!(k+1ij)!(k+1)!(k+1j)!Bik+11i=0k+1jCk+1jiCk+1jBik+11Ck+1ji=0k+1jCk+1jiBik+11Ck+1j(i=0kjCkj+1iBi+Bk+1j)i=0kCk+1iBi=0,k1k+11Ck+1jBk+1j
综上有:
{a0=0ai=1k+1Ck+1iBk+1−i1≤i<kak=B1+B0ak+1=1k+1\left\{ \begin{aligned} a_0 & = 0\\ a_i & = \frac{1}{k + 1}C_{k + 1} ^{i} B_{k + 1 - i} & 1 \leq i < k\\ a_k & = B_1 + B_0 \\ a_{k + 1} & = \frac{1}{k + 1}\\ \end{aligned} \right. a0aiakak+1=0=k+11Ck+1iBk+1i=B1+B0=k+111i<k

再考虑对原式化简:

ak,ja_{k, j}ak,jkkk次自然数幂之和的多项式的第jjj项,也就是上面化简的。
∑d∣nμ(d)∑i=1ndsid∑d∣nμ(d)∑i=1nd∑j=0k+1ak,jijdj∑j=0k+1ak,j∑d∣nμ(d)dj∑i=1ndij∑j=0k+1ak,j∑d∣nμ(d)dj∑i=0j+1aj,inid−i∑d∣nμ(d)∑i=−1k+1di∑x=0k+1∑y=0k+1[x−y=i]ak,xax,yny∑d∣nμ(d)∑i=−1k+1diFi+1∑i=−1k+1Fi+1∑d∣nμ(d)di\sum_{d \mid n} \mu(d) \sum_{i = 1} ^{\frac{n}{d}} s_{id}\\ \sum_{d \mid n} \mu(d) \sum_{i = 1} ^{\frac{n}{d}} \sum_{j = 0} ^{k + 1} a_{k, j} i ^{j} d ^{j}\\ \sum_{j = 0} ^{k + 1} a_{k, j} \sum_{d \mid n} \mu(d) d ^ j \sum_{i = 1} ^{\frac{n}{d}} i ^ j\\ \sum_{j = 0} ^{k + 1} a_{k, j} \sum_{d \mid n} \mu(d) d ^ j \sum_{i = 0} ^{j + 1} a_{j, i} n ^{i} d ^{-i}\\ \sum_{d \mid n} \mu(d) \sum_{i = -1} ^{k + 1} d ^{i} \sum_{x = 0} ^{k + 1} \sum_{y = 0} ^{k + 1}[x - y = i] a_{k, x}a_{x, y}n ^{y}\\ \sum_{d \mid n} \mu(d) \sum_{i = -1} ^{k + 1} d ^{i} F_{i + 1}\\ \sum_{i = -1} ^{k + 1} F_{i + 1} \sum_{d \mid n} \mu(d) d ^{i}\\ dnμ(d)i=1dnsiddnμ(d)i=1dnj=0k+1ak,jijdjj=0k+1ak,jdnμ(d)dji=1dnijj=0k+1ak,jdnμ(d)dji=0j+1aj,inididnμ(d)i=1k+1dix=0k+1y=0k+1[xy=i]ak,xax,ynydnμ(d)i=1k+1diFi+1i=1k+1Fi+1dnμ(d)di

f(n)=∑d∣nμ(d)dif(n) = \sum\limits_{d \mid n} \mu(d) d ^ if(n)=dnμ(d)di,考虑其积性f(1)=1,f(p)=μ(1)+μ(p)pi=1−pi,f(pk)=f(p)f(1) = 1, f(p) = \mu(1) + \mu(p) p ^ i = 1 - p ^ i, f(p ^ k) =f(p)f(1)=1,f(p)=μ(1)+μ(p)pi=1pi,f(pk)=f(p)

所以答案为∑i=−1k+1Fi+1∑d∣nμ(d)di\sum\limits_{i = -1} ^{k + 1} F_{i + 1} \sum\limits_{d \mid n} \mu(d) d ^ ii=1k+1Fi+1dnμ(d)di,考虑如何求解Fi+1F_{i + 1}Fi+1
Fi=∑x=0k+1∑y=0k+1[x−y=i−1]ak,xax,yny∑x=0k+1ak,xax,x−i+1nx−i+1∑x=1k+1ak,xax,x−i+1nx−i+1∑x=0kak,x+1,ax+1,x−i+2nx−i+2∑x=0k1k+1Ck+1x+1Bk−x1x+2Cx+2iBinx−i+2∑x=0k1k+1(k+1)!(x+1)!(k−x)!Bk−x1x+2(x+2)!i!(x+2−i)!Binx−i+2k!Bii!∑x=0kBk−x(k−x)!nx−i+2(x−i+2)!F_i = \sum\limits_{x = 0} ^{k + 1} \sum\limits_{y = 0} ^{k + 1}[x - y = i - 1] a_{k, x}a_{x, y} n ^ y\\ \sum_{x = 0} ^{k + 1} a_{k, x} a_{x, x - i + 1} n ^{x - i + 1}\\ \sum_{x = 1} ^{k + 1} a_{k, x} a_{x, x - i + 1} n ^{x - i + 1}\\ \sum_{x = 0} ^{k} a_{k, x + 1}, a_{x + 1, x - i + 2} n ^{x - i + 2}\\ \sum_{x = 0} ^{k} \frac{1}{k + 1}C_{k + 1} ^{x + 1} B_{k - x} \frac{1}{x + 2} C_{x + 2} ^{i} B_{i} n ^{x - i + 2}\\ \sum_{x = 0} ^{k} \frac{1}{k + 1} \frac{(k + 1)!}{(x + 1)!(k - x)!} B_{k - x} \frac{1}{x + 2} \frac{(x + 2)!}{i!(x + 2 - i)!} B_i n ^{x - i + 2}\\ \frac{k! B_i}{i!} \sum_{x = 0} ^{k} \frac{B_{k - x}}{(k - x)!} \frac{n ^{x - i + 2}}{(x - i + 2)!}\\ Fi=x=0k+1y=0k+1[xy=i1]ak,xax,ynyx=0k+1ak,xax,xi+1nxi+1x=1k+1ak,xax,xi+1nxi+1x=0kak,x+1,ax+1,xi+2nxi+2x=0kk+11Ck+1x+1Bkxx+21Cx+2iBinxi+2x=0kk+11(x+1)!(kx)!(k+1)!Bkxx+21i!(x+2i)!(x+2)!Binxi+2i!k!Bix=0k(kx)!Bkx(xi+2)!nxi+2

由此我们得到一个卷积得形式,可O(klog⁡k)O(k \log k)O(klogk)求解。

#include <bits/stdc++.h>using namespace std;const int N = 1e6 + 10, mod = 998244353;int r[N], t[N], B[N], b[N], fac[N], ifac[N];int quick_pow(int a, int n) {int ans = 1;while (n) {if (n & 1) {ans = 1ll * a * ans % mod;}a = 1ll * a * a % mod;n >>= 1;}return ans;
}void get_r(int lim) {for (int i = 0; i < lim; i++) {r[i] = (i & 1) * (lim >> 1) + (r[i >> 1] >> 1);}
}void NTT(int *f, int lim, int rev) {for (int i = 0; i < lim; i++) {if (i < r[i]) {swap(f[i], f[r[i]]);}}for (int mid = 1; mid < lim; mid <<= 1) {int wn = quick_pow(3, (mod - 1) / (mid << 1));for (int len = mid << 1, cur = 0; cur < lim; cur += len) {int w = 1;for (int k = 0; k < mid; k++, w = 1ll * w * wn % mod) {int x = f[cur + k], y = 1ll * w * f[cur + mid + k] % mod;f[cur + k] = (x + y) % mod, f[cur + mid + k] = (x - y + mod) % mod;}}}if (rev == -1) {int inv = quick_pow(lim, mod - 2);reverse(f + 1, f + lim);for (int i = 0; i < lim; i++) {f[i] = 1ll * f[i] * inv % mod;}}
}void polyinv(int *f, int *g, int n) {if (n == 1) {g[0] = quick_pow(f[0], mod - 2);return ;}polyinv(f, g, n + 1 >> 1);for (int i = 0; i < n; i++) {t[i] = f[i];}int lim = 1;while (lim < 2 * n) {lim <<= 1;}get_r(lim);NTT(t, lim, 1);NTT(g, lim, 1);for (int i = 0; i < lim; i++) {int cur = (2 - 1ll * g[i] * t[i] % mod + mod) % mod;g[i] = 1ll * g[i] * cur % mod;t[i] = 0;}NTT(g, lim, -1);for (int i = n; i < lim; i++) {g[i] = 0;}
}void init() {fac[0] = 1;for (int i = 1; i < N; i++) {fac[i] = 1ll * fac[i - 1] * i % mod;}ifac[N - 1] = quick_pow(fac[N - 1], mod - 2);for (int i = N - 2; i >= 0; i--) {ifac[i] = 1ll * ifac[i + 1] * (i + 1) % mod;}int n = 1e5 + 10, len = 1;for (int i = 0; i < n; i++) {B[i] = ifac[i + 1];}polyinv(B, b, n);for (int i = 0; i < n; i++) {B[i] = 1ll * b[i] * fac[i] % mod;b[i] = 0;}B[1] = mod - B[1];
}int k, m, n, a[N], num[N], c[N], d[N], pw[N];void polymult(int *a, int n, int *b, int m) {int lim = 1;while (lim < n + m) {lim <<= 1;}get_r(lim);for (int i = n; i < lim; i++) {a[i] = 0;}for (int i = m; i < lim; i++) {b[i] = 0;}NTT(a, lim, 1), NTT(b, lim, 1);for (int i = 0; i < lim; i++) {a[i] = 1ll * a[i] * b[i] % mod;}NTT(a, lim, -1);
}int main() {// freopen("in.txt", "r", stdin);// freopen("out.txt", "w", stdout);// ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);init();int T;scanf("%d", &T);while (T--) {scanf("%d %d", &k, &m);n = 1;for (int i = 1; i <= m; i++) {scanf("%d %d", &a[i], &num[i]);n = 1ll * n * quick_pow(a[i], num[i]) % mod;}int lim = 1;while (lim < k * 2 + 10) {lim <<= 1;}for (int i = 0; i <= lim; i++) {c[i] = d[i] = 0;}for (int i = 0; i <= k; i++) {c[k + 1 - i] = 1ll * fac[k] * ifac[i] % mod * B[i] % mod;}int pow = 1;for (int i = 1; i <= k + 2; i++) {pow = 1ll * pow * n % mod;d[k + 2 - i] = 1ll * pow * ifac[i] % mod;}polymult(c, lim, d, lim);for (int i = 1; i <= m; i++) {pw[i] = quick_pow(a[i], mod - 2);}int ans = 0;for (int d = -1; d <= k; d++) {int gg = 1ll * c[d + k + 2] * B[d + 1] % mod * ifac[d + 1] % mod;for (int i = 1; i <= m; i++) {gg = 1ll * gg * (1 - pw[i] + mod) % mod;pw[i] = 1ll * pw[i] * a[i] % mod;}ans = (ans + gg) % mod;}printf("%d\n", ans);}return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/313830.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

干货|亲测有效的N倍学习效果笔记法

这里是Z哥的个人公众号每周五11&#xff1a;45 按时送达当然了&#xff0c;也会时不时加个餐&#xff5e;我的第「108」篇原创敬上大家好&#xff0c;我是Z哥。先祝大家中秋快乐。我猜你现在心情不错&#xff0c;毕竟小长假的第一天才开始&#xff0c;后面还有60个小时的假期&a…

Java偏向锁、轻量级锁、重量级锁

先Mark&#xff0c;后补充 参照&#xff1a; https://www.infoq.cn/article/java-se-16-synchronized http://www.cnblogs.com/paddix/p/5405678.html http://www.cnblogs.com/lzh-blogs/p/7477157.html

.NET Core 3.0 可卸载程序集原理简析

文章转载授权级别&#xff1a;A 预计阅读时间&#xff1a;8分钟 损失发量&#xff1a;不好统计因为最近在群里被问到如何理解 .NET Core 3.0 可卸载程序集&#xff0c;所以就写了这篇简单的分析。因为时间实在很少&#xff0c;这篇文章只简单的罗列了相关的代码&…

P4331 [BalticOI 2004]Sequence 数字序列(左偏树)

P4331 [BalticOI 2004]Sequence 数字序列 给定一个序列整数a1,a2,a3,…,an−1,ana_1, a_2, a_3, \dots, a_{n - 1}, a_na1​,a2​,a3​,…,an−1​,an​&#xff0c;要找一个整数序列bbb&#xff0c;满足b1<b2<b3<⋯<bn−1<bnb_1 < b_2 < b_3< \dots&…

.NetCore技术研究-ConfigurationManager在单元测试下的坑

最近在将原有代码迁移.NET Core, 代码的迁移基本很快&#xff0c;当然也遇到了不少坑&#xff0c;重构了不少&#xff0c;后续逐步总结分享给大家。今天总结分享一下ConfigurationManager遇到的一个问题。先说一下场景&#xff1a;迁移.NET Core后&#xff0c;已有的配置文件&a…

E 速度即转发(牛客挑战赛48)(树套树)

速度即转发 给定一个长度为nnn的数组aaa&#xff0c;里面元素为a1,a2,a3,…,an−1,ana_1, a_2, a_3, \dots, a_{n - 1}, a_na1​,a2​,a3​,…,an−1​,an​。 有两种操作&#xff1a; 修改apka_p kap​k。给定l,r,kl, r, kl,r,k&#xff0c;设S(x)∑ilrmax(ai−x,0)S(x) …

volatile实现原理

先Mark&#xff0c;后续完成 https://segmentfault.com/a/1190000017255405 http://ifeve.com/volatile/ http://cmsblogs.com/?hmsrtoutiao.io&p2092&utm_mediumtoutiao.io&utm_sourcetoutiao.io https://my.oschina.net/u/2288283/blog/656572 https://blog.…

分析一次double强转float的翻车原因

人逢喜事精神爽,总算熬到下班撩~~正准备和同事打个招呼回家,被同事拖住问了.?‍♂️: 你们组做的那块代码,把double类型数据成float有问题啊?.?‍♀️: 嗯?不对是正常啊,float精度是没有double高,但float能保存到小数点后好多位,对我们来说完全够用了!?‍♂️: 不是啊,这不…

L 苍天阻我寻你,此情坚贞如一(西南科技大学2021届新生赛)(线段树)

苍天阻我寻你&#xff0c;此情坚贞如一 给定两个长度为nnn的数组a,ba, ba,b&#xff0c;满足−103≤ai,bi≤103-10 ^ 3 \leq a_i, b_i \leq 10 ^ 3−103≤ai​,bi​≤103&#xff0c;每个数字xxx表示向前走xxx步&#xff0c;如果是负数则后退嘛&#xff0c;设小AAA执行aaa数组…

Java并发常用方法 sleep 和 wait

一&#xff1a;sleep 和 wait sleep()方法&#xff1a; 功能&#xff1a;让当前线程休眠指定时间&#xff0c;休眠时间的准确性依赖于系统时钟和CPU调度机制是Thread类的静态方法可在任何地方调用&#xff0c;需要处理InterruptedException当前线程调用sleep()方法&#xff0…

.NET Core 3.0之深入源码理解Host(二)

写在前面停了近一个月的技术博客&#xff0c;随着正式脱离996的魔窟&#xff0c;接下来也正式恢复了。本文从源码角度进一步讨论.NET Core 3.0 中关于Host扩展的一些技术点&#xff0c;主要内容是关于创建Long Run Program的创建与守护。关于Host&#xff0c;我们最容易想到的就…

Finding Hotels(牛客国庆集训派对Day7 )(2016ICPC青岛K)(K-D Tree)

Finding Hotels 给定二维平面上nnn个点&#xff0c;每个点描述为x,y,cx, y, cx,y,c&#xff0c;x,yx, yx,y为坐标&#xff0c;ccc为该点的价值&#xff0c; 有mmm个询问&#xff0c;每次询问给x,y,cx, y, cx,y,c&#xff0c;要求&#xff0c;点的价值小于等于ccc的条件下&…

Java多线程常用方法 wait 和 notify

一&#xff1a;从一道面试题说起 启动两个线程, 一个输出 1,3,5,7…99, 另一个输出 2,4,6,8…100 最后 STDOUT 中按序输出 1,2,3,4,5…100 要求用 Java 的 wait notify 机制来实现 解法&#xff1a; public class Test {private static Object lock new Object();private st…

dotNET Core实现分布式环境下的流水号唯一

业务背景在管理系统中&#xff0c;很多功能模块都会涉及到各种类型的编号&#xff0c;例如&#xff1a;流程编号、订单号、合同编号等等。编号各有各自的规则&#xff0c;但通常有一个流水号来确定编号的唯一性&#xff0c;保证流水号的唯一&#xff0c;在不同的环境中实现方式…

单位根反演小记

单位根反演 一个等式&#xff1a;[n∣a]1n∑k0n−1wnak[n \mid a] \frac{1}{n} \sum\limits_{k 0} ^{n - 1}w_n ^{ak}[n∣a]n1​k0∑n−1​wnak​ 证明&#xff1a; wnaw_n ^ awna​是nnn次单位根的aaa次方&#xff0c;所以这里是一个公比为wnaw_n ^ awna​的等比数列&…

.NET Core3发布Json API

我们给DNC3&#xff08;.NET Core 3&#xff09;上了一个新包&#xff0c;叫做System.Text.Json(点我下载)&#xff0c;支持读写器&#xff0c;DOM&#xff08;文档对象模型&#xff09;&#xff0c;和序列化&#xff0c;在这篇博文里&#xff0c;我会告诉大家为什么要做这个&a…

Java ThreadLocal

** 一&#xff1a;ThreadLocal的简要介绍及使用 ** Java中的ThreadLocal类允许我们创建只能被同一个线程读写的变量。因此&#xff0c;如果一段代码含有一个ThreadLocal变量的引用&#xff0c;即使两个线程同时执行这段代码&#xff0c;它们也无法访问到对方的ThreadLocal变…

P5591 小猪佩奇学数学(单位根反演)

P5591 小猪佩奇学数学 ∑i0n(in)pi⌊ik⌋⌊ik⌋i−i%kk1k∑i0n(in)pi(i−i%k)1k∑i0n(in)pii−1k∑i0n(in)pi(imodk)\sum_{i 0} ^{n} (_i ^ n) \times p ^ i \times \lfloor \frac{i}{k} \rfloor\\ \lfloor \frac{i}{k} \rfloor \frac{i - i \% k}{k}\\ \frac{1}{k} \sum_{i …

认证方案之初步认识JWT

前言&#xff1a;现在越来越多的项目或多或少会用到JWT&#xff0c;为什么会出现使用JWT这样的场景的呢&#xff1f;假设现在有一个APP&#xff0c;后台是分布式系统。APP的首页模块部署在上海机房的服务器上&#xff0c;子页面模块部署在深圳机房的服务器上。此时你从首页登录…

Java实现生产消费模型的5种方式

** 前言 ** 生产者和消费者问题是线程模型中的经典问题&#xff1a;生产者和消费者在同一时间段内共用同一个存储空间&#xff0c;生产者往存储空间中添加产品&#xff0c;消费者从存储空间中取走产品&#xff0c;当存储空间为空时&#xff0c;消费者阻塞&#xff0c;当存储…