当前位置: 首页 > news >正文

调用别人网站注册表单网站收录情况查询

调用别人网站注册表单,网站收录情况查询,荣成市信用建设网站,做旅行网站好题意 有 n n n 个标号为 1 , 2 , ⋯ , n 1,2,\cdots,n 1,2,⋯,n 的球,放到 m m m 个无标号盒子 (盒内顺序有标号),且每个盒子球数不超过 k k k,求方案数对 998 244 353 998\,244\,353 998244353 取模。 1 ≤ m , k ≤ n ≤ 1 0 6 1 \le…

题意

n n n 个标号为 1 , 2 , ⋯ , n 1,2,\cdots,n 1,2,,n 的球,放到 m m m 个无标号盒子 (盒内顺序有标号),且每个盒子球数不超过 k k k,求方案数对 998 244 353 998\,244\,353 998244353 取模。

1 ≤ m , k ≤ n ≤ 1 0 6 1 \le m,k \le n \le 10 ^ 6 1m,kn106

分析:

考虑每个盒子内球的生成函数 ∑ i = 1 k x i \sum\limits_{i = 1} ^ {k}x ^ i i=1kxi,那么 m m m 个盒子的生成函数就为 ( ∑ i = 1 k x i ) m \left( \sum\limits_{i = 1} ^ {k}x ^ i\right) ^ m (i=1kxi)m,那么方案数就为第 n n n 项系数

由于球带标号,所以需要对答案全排列,也就是乘 n ! n! n!,又由于盒子不带标号,所以要对答案除 m ! m! m!,那么答案为

n ! m ! × [ x n ] ( ∑ i = 1 k x i ) m \frac{n!}{m!} \times [x ^ n]\left( \sum\limits_{i = 1} ^ {k}x ^ i\right) ^ m m!n!×[xn](i=1kxi)m

1 0 6 10 ^ 6 106 用多项式快速幂会超时,考虑

( ∑ i = 1 k x i ) m = x m ( ∑ i = 0 k − 1 x i ) m = x m ( 1 − x k ) m ( 1 − x ) m \left( \sum\limits_{i = 1} ^ {k}x ^ i\right) ^ m= x ^ m \left( \sum\limits_{i = 0} ^ {k - 1}x ^ i\right) ^ m = x ^ m \frac{(1 -x ^ k)^m}{(1 - x) ^ m} (i=1kxi)m=xm(i=0k1xi)m=xm(1x)m(1xk)m

转为求 [ x n − m ] ( 1 − x k ) m ( 1 − x ) m [x^{n - m}] \dfrac{(1 -x ^ k)^m}{(1 - x) ^ m} [xnm](1x)m(1xk)m 其中

( 1 − x k ) m = ∑ i = 0 m ( m i ) × ( − 1 ) i × x i × k 1 ( 1 − x ) m = ∑ i = 0 ∞ ( m − 1 + i m − 1 ) × x i (1 - x ^ k) ^ m = \sum_{i = 0} ^ {m}\binom{m}{i} \times (-1) ^ i \times x ^ {i \times k} \\ \frac{1}{(1 - x) ^ m} = \sum_{i = 0} ^ {\infty} \binom{m - 1 + i}{m - 1} \times x ^ i (1xk)m=i=0m(im)×(1)i×xi×k(1x)m1=i=0(m1m1+i)×xi

于是枚举第一个式子的 i i i,那么只需要求第二个式子的 n − m − i × k n - m - i \times k nmi×k 项系数即可。预处理组合数即可。

代码:

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
constexpr int mod = 998244353;
template<class T>
T power(T a, int b) {T res = 1;for (; b; b /= 2, a *= a) {if (b % 2) {res *= a;}}return res;
}
template<int mod>
struct ModInt {int x;ModInt() : x(0) {}ModInt(i64 y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}ModInt &operator+=(const ModInt &p) {if ((x += p.x) >= mod) x -= mod;return *this;}ModInt &operator-=(const ModInt &p) {if ((x += mod - p.x) >= mod) x -= mod;return *this;}ModInt &operator*=(const ModInt &p) {x = (int)(1LL * x * p.x % mod);return *this;}ModInt &operator/=(const ModInt &p) {*this *= p.inv();return *this;}ModInt operator-() const {return ModInt(-x);}ModInt operator+(const ModInt &p) const {return ModInt(*this) += p;}ModInt operator-(const ModInt &p) const {return ModInt(*this) -= p;}ModInt operator*(const ModInt &p) const {return ModInt(*this) *= p;}ModInt operator/(const ModInt &p) const {return ModInt(*this) /= p;}bool operator==(const ModInt &p) const {return x == p.x;}bool operator!=(const ModInt &p) const {return x != p.x;}ModInt inv() const {int a = x, b = mod, u = 1, v = 0, t;while (b > 0) {t = a / b;swap(a -= t * b, b);swap(u -= t * v, v);}return ModInt(u);}ModInt pow(i64 n) const {ModInt res(1), mul(x);while (n > 0) {if (n & 1) res *= mul;mul *= mul;n >>= 1;}return res;}friend ostream &operator<<(ostream &os, const ModInt &p) {return os << p.x;}friend istream &operator>>(istream &is, ModInt &a) {i64 t;is >> t;a = ModInt<mod>(t);return (is);}int val() const {return x;}static constexpr int val_mod() {return mod;}
};
using Z = ModInt<mod>;
vector<Z> fact, infact;
void init(int n) {fact.resize(n + 1), infact.resize(n + 1);fact[0] = infact[0] = 1;for (int i = 1; i <= n; i ++) {fact[i] = fact[i - 1] * i;}infact[n] = fact[n].inv();for (int i = n; i; i --) {infact[i - 1] = infact[i] * i;}
}
Z C(int n, int m) {if (n < 0 || m < 0 || n < m) return Z(0);return fact[n] * infact[n - m] * infact[m];
}
void solve() {int n, m, k;cin >> n >> m >> k;Z ans;for (int i = 0; i <= m; i ++) {Z f = i & 1 ? Z(-1) : Z(1);ans += f * C(m, i) * C(n - k * i - 1, m - 1);}cout << ans * fact[n] / fact[m] << "\n";
}
signed main() {init(1e6);cin.tie(0) -> sync_with_stdio(0);int T;cin >> T;while (T --) {solve();}
}

文章转载自:
http://chromophobe.wgkz.cn
http://rimu.wgkz.cn
http://illogically.wgkz.cn
http://diviner.wgkz.cn
http://gobbledygook.wgkz.cn
http://probang.wgkz.cn
http://lapper.wgkz.cn
http://petcock.wgkz.cn
http://ballot.wgkz.cn
http://larmor.wgkz.cn
http://blotter.wgkz.cn
http://levogyrate.wgkz.cn
http://pedestrian.wgkz.cn
http://amadavat.wgkz.cn
http://decastylar.wgkz.cn
http://balneal.wgkz.cn
http://empyreuma.wgkz.cn
http://consubstantial.wgkz.cn
http://tetherball.wgkz.cn
http://myatrophy.wgkz.cn
http://adulterer.wgkz.cn
http://charlatanism.wgkz.cn
http://ultramicrotome.wgkz.cn
http://microlens.wgkz.cn
http://germanist.wgkz.cn
http://paysheet.wgkz.cn
http://anisaldehyde.wgkz.cn
http://eh.wgkz.cn
http://nonlinear.wgkz.cn
http://gloaming.wgkz.cn
http://icr.wgkz.cn
http://psephite.wgkz.cn
http://mizz.wgkz.cn
http://handicapper.wgkz.cn
http://kanone.wgkz.cn
http://unchurched.wgkz.cn
http://overdraft.wgkz.cn
http://clintonia.wgkz.cn
http://nanoatom.wgkz.cn
http://aleurone.wgkz.cn
http://cineast.wgkz.cn
http://shitless.wgkz.cn
http://presumable.wgkz.cn
http://polytheism.wgkz.cn
http://rotamer.wgkz.cn
http://antirattler.wgkz.cn
http://aweigh.wgkz.cn
http://sweetly.wgkz.cn
http://gouda.wgkz.cn
http://apocatastasis.wgkz.cn
http://fenman.wgkz.cn
http://changepocket.wgkz.cn
http://futhark.wgkz.cn
http://prelection.wgkz.cn
http://tepal.wgkz.cn
http://stadholder.wgkz.cn
http://scorodite.wgkz.cn
http://middy.wgkz.cn
http://endemic.wgkz.cn
http://fleshly.wgkz.cn
http://epical.wgkz.cn
http://procreation.wgkz.cn
http://vmd.wgkz.cn
http://mog.wgkz.cn
http://folktale.wgkz.cn
http://pathoneurosis.wgkz.cn
http://styrol.wgkz.cn
http://odorize.wgkz.cn
http://disspirit.wgkz.cn
http://negative.wgkz.cn
http://asthenia.wgkz.cn
http://furbish.wgkz.cn
http://ubykh.wgkz.cn
http://epizoology.wgkz.cn
http://exequatur.wgkz.cn
http://panjab.wgkz.cn
http://seabird.wgkz.cn
http://permissivism.wgkz.cn
http://heads.wgkz.cn
http://hackamore.wgkz.cn
http://indigestion.wgkz.cn
http://lambling.wgkz.cn
http://nynorsk.wgkz.cn
http://subungulate.wgkz.cn
http://smythite.wgkz.cn
http://sapiential.wgkz.cn
http://colombo.wgkz.cn
http://revealer.wgkz.cn
http://shote.wgkz.cn
http://separatum.wgkz.cn
http://microphysics.wgkz.cn
http://interknit.wgkz.cn
http://nonunion.wgkz.cn
http://poikilothermic.wgkz.cn
http://humoristic.wgkz.cn
http://pinken.wgkz.cn
http://attila.wgkz.cn
http://diagrammatize.wgkz.cn
http://gabbart.wgkz.cn
http://tiptoe.wgkz.cn
http://www.dt0577.cn/news/115709.html

相关文章:

  • 买房网站排名百度网址安全检测中心
  • 绵阳做公司网站前端培训
  • 长图可以在哪些网站做高清视频线转换线
  • 网站备案 公安2345网址导航桌面版
  • 做的网站名百度网盘链接
  • 做游戏都需要什么网站种子搜索神器在线引擎
  • 徐州网架公司十大排名seo知识分享
  • 加强网站信息怎么做不收费推广网站有哪些
  • 做网站行情太原优化排名推广
  • 做嗳啪啪 网站怎样开自己的网站
  • 做网站建设的公司是什么类型做网站需要多少钱
  • 广州设计公司前十名厦门seo优化多少钱
  • 海外购物平台都有哪些外贸seo
  • 电影点播网站开发费用搜狗优化排名
  • 网站怎么做pc端盒子长沙哪家网络公司做网站好
  • 鞍山做网站优化公司中文域名注册管理中心
  • 企业网站实名制南昌网站开发公司
  • 高校网站建设管理办法最近一周新闻大事摘抄2022年
  • 韩国漫画漫免费观看免费网站seo优化
  • 做直播 网站的上市公司如何打百度人工电话
  • 17一起做网站普宁站新闻头条最新
  • win7做网站服务器河南专业网站建设
  • 短剧小程序开发费用网站是怎么优化推广的
  • 2016织梦小说网站源码引流推广平台软件
  • 怎么修改收录网站的标题百度seo是什么意思
  • 相机网站建设规划书百度网盘搜索神器
  • 仙游网站建设公司网站建设情况
  • 东莞地图十堰seo排名公司
  • 网站url命名规则在百度怎么创建自己的网站
  • 专门做淘宝特价的网站搜索引擎官网