C. The Intriguing Obsession
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

— This is not playing but duty as allies of justice, Nii-chan!

— Not allies but justice itself, Onii-chan!

With hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sisters — Karen and Tsukihi — is heading for somewhere they've never reached — water-surrounded islands!

There are three clusters of islands, conveniently coloured red, blue and purple. The clusters consist of ab and c distinct islands respectively.

Bridges have been built between some (possibly all or none) of the islands. A bridge bidirectionally connects two different islands and has length 1. For any two islands of the same colour, either they shouldn't be reached from each other through bridges, or the shortest distance between them is at least 3, apparently in order to prevent oddities from spreading quickly inside a cluster.

The Fire Sisters are ready for the unknown, but they'd also like to test your courage. And you're here to figure out the number of different ways to build all bridges under the constraints, and give the answer modulo 998 244 353. Two ways are considered different if a pair of islands exist, such that there's a bridge between them in one of them, but not in the other.

Input

The first and only line of input contains three space-separated integers ab and c (1 ≤ a, b, c ≤ 5 000) — the number of islands in the red, blue and purple clusters, respectively.

Output

Output one line containing an integer — the number of different ways to build bridges, modulo 998 244 353.

Examples
input

Copy

1 1 1

output
8

input

Copy

1 2 2

output
63

input

Copy

1 3 5

output
3264

input

Copy

6 2 9

output
813023575

Note

In the first example, there are 3 bridges that can possibly be built, and no setup of bridges violates the restrictions. Thus the answer is 23 = 8.

In the second example, the upper two structures in the figure below are instances of valid ones, while the lower two are invalid due to the blue and purple clusters, respectively.

题意:有三种颜色的岛屿,其中同种颜色的岛屿之间的距离>=3(即不能连同一个) . 考虑到,任意两种颜色直接的方案与其他组合无关 . 那么根据组合数学的知识,我们可以得到两种颜色的方案数为sigma(c[a][i]*c[b][i]*fac[i])

#include<bits/stdc++.h>
#define bug cout <<"bug"<<endl;
#define read(x) scanf("%d",&x)
using namespace std;
typedef long long ll;const int MAX_N=5005;
const int MOD=998244353;
const int INF=0x3f3f3f3f;ll fact[MAX_N];
ll c[MAX_N][MAX_N];ll cul(ll a,ll b){ll k=min(a,b);ll ans=0;for(ll i=0;i<=k;i++){ans+=(c[a][i]*c[b][i]%MOD*fact[i])%MOD;ans%=MOD;}return ans;
}void init(){fact[0]=1;for(int i=1;i<=5000;i++)    fact[i]=i*fact[i-1]%MOD;c[0][0]=c[1][0]=c[1][1]=1;for(int i=2;i<=5000;i++){c[i][0]=1;for(int j=1;j<=5000;j++)c[i][j]+=(c[i-1][j]+c[i-1][j-1])%MOD,c[i][j]%=MOD;}return ;
}int main(void){init();ll a,b,c;cin >> a >> b >>c;cout << cul(a,b)%MOD*cul(a,c)%MOD*cul(b,c)%MOD << endl; //注意取模return 0;
}

C. The Intriguing Obsession[组合数学]相关推荐

  1. codeforces 869C The Intriguing Obsession 组合数学,逆元

    codeforces 869C The Intriguing Obsession 题意 在三种颜色的群岛之间建造桥梁,每一种颜色分别有a,b,c 限制条件 1 相同颜色的岛之间的距离 d >= ...

  2. Codeforces Round #439 C.The Intriguing Obsession(组合数学)

    C. The Intriguing Obsession time limit per test1 secondmemory limit per test256 megabytesinputstanda ...

  3. 【Codeforces 869 C The Intriguing Obsession】 组合数学 思维

    C. The Intriguing Obsession time limit per test1 second memory limit per test256 megabytes inputstan ...

  4. codeforces 869C The Intriguing Obsession【组合数学+dp+第二类斯特林公式】

    C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input s ...

  5. The Intriguing Obsession

    C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input s ...

  6. C. The Intriguing Obsession

    C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input s ...

  7. Codefrces 869C. The Intriguing Obsession

    C. The Intriguing Obsession - This is not playing but duty as allies of justice, Nii-chan! - Not all ...

  8. CF869C:C. The Intriguing Obsession(组合数)

    C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input s ...

  9. Codeforces 869C The Intriguing Obsession 组合数取模

    Codeforces 869C The Intriguing Obsession 思考一下人生. 这是一场物语场,而且A题直接puts("Karen")能过,我对此印象非常深.我不 ...

最新文章

  1. 汇编调用c语言函数 call printf,如何在汇编调用c语言函数?
  2. SQL Server表的数据量大小查询
  3. 鲜为人知的C++ IO fstream流
  4. contiki源码阅读之list
  5. 一种绕过Android P对非SDK接口限制的简单方法
  6. Java-类与对象的创建
  7. mysql记录当前表数据的数据条数据类型_MySQL学习记录:数据类型与操作数据表...
  8. 西游记与面向对象编程
  9. 多线程打印ABCD顺序(带有线程池实现)
  10. c++ strcmp函数
  11. jQuery API .ajaxComplete()
  12. 黑群晖DSM 6.1网卡支持列表
  13. 转:以Delphi Package架构多人开发应用程序环境
  14. epoll反应堆及ET模式下的EPOLLOUT学习总结
  15. [论文阅读] 对话式推荐系统的进展与挑战:综述(Advances and Challenges in Conversational Recommender Systems: ASurvey)-01
  16. linux va start,linux下strftime(),va_start(),va_end()函数的用法
  17. 生鲜电商之百果园的未来
  18. 运维危险操作之windows server打开或关闭windows功能
  19. 【2020年高被引学者】 田奇 华为
  20. 最简单的混合开发教程:APICloud.

热门文章

  1. Xposed框架初次见面-开发自己的Xposed插件
  2. 医疗和牙科3D打印的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告
  3. .vdat文件怎么打开
  4. 程序员面试 算法研究 编程艺术 红黑树 机器学习5大系列集锦
  5. 直播系统开发之ios对接腾讯云直播sdk
  6. Kafka消费者订阅方式
  7. 15分钟正则表达式快速上手(js)
  8. UEditor .Net版本任意文件上传漏洞复现
  9. 3D打印断电、断料续打,打印一半中断续打改代码,也适用于单喷头多色打印(用cura切片)
  10. 经典的开源免费网络游戏:planeshift