标签:数学

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

— Not allies but justice itself, Onii-chan!

With hands joined, go everywhere at a speedfaster than our thoughts! This time, the Fire Sisters — Karen andTsukihi — 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 a, band c distinct islands respectively.

Bridges have been built between some(possibly all or none) of the islands. A bridge bidirectionally connects twodifferent 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 theshortest distance between them is at least 3, apparently in order to preventoddities 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 thenumber of different ways to build all bridges under the constraints, and givethe answer modulo 998 244 353. Two ways areconsidered different if a pair of islands exist, such that there's a bridgebetween them in one of them, but not in the other.

Input

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

Output

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

Examples

Input

1 1 1

Output

8

Input

1 2 2

Output

63

Input

1 3 5

Output

3264

Input

6 2 9

Output

813023575

Note

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

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

分析:比赛的时候一直认为这题和杨辉三角有关(由于去年NOIP2016D2T1的坑)然后完美gg

正解应该是动规了吧(或者说是递推)

我们可以将a,b,c三个数分成(a,b,1),(a,c,1),(b,c,1)

将上述的三种情况相乘再取模就是最终的答案

而对于任意一种情况a,b

F(a,b)=f(a-1,b-1)*b+f(a-1,b)

Code

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define LL unsigned long long
using namespace std;
const int maxn=5006,mod=998244353;
LL a,b,c,f[maxn][maxn],Max=0;int main()
{cin>>a>>b>>c;Max=max(a,max(b,c));rep(i,0,Max)f[i][0]=1,f[0][i]=1;rep(i,1,Max)rep(j,1,Max)f[i][j]=((f[i-1][j-1]*j)%mod+f[i-1][j])%mod;cout<<(((f[a][b]*f[b][c])%mod)*f[a][c])%mod<<endl;return 0;
}

Codeforces869C The Intriguing Obsession相关推荐

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

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

  2. The Intriguing Obsession

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

  3. C. The Intriguing Obsession

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

  4. Codefrces 869C. The Intriguing Obsession

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

  5. C. The Intriguing Obsession[组合数学]

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

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

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

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

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

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

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

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

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

最新文章

  1. 凭借这份Java面试题集,java上传文件夹
  2. 牛客题霸 [表达式求值] C++题解/答案
  3. hive中not in优化
  4. Python数据结构:二分查找
  5. C#基础16:事件与观察者模式
  6. 欢迎大家推荐使用小技巧
  7. CCNA(高级实验)
  8. JS实现本地文件选择
  9. 前端和后端哪个工资更高呢?
  10. 点击地图出现导航php,在H5页面中,通过地址打开高德地图以实现导航
  11. java c语言 关系_java和c语言有什么共同点?
  12. python计算列表里各科的成绩(算法)
  13. 地理坐标系VS大地坐标系
  14. 机器学习线性回归实践,波士顿房价预测,手写梯度下降
  15. base64图片转file的处理
  16. 元组的拆包和具名元组
  17. 计算机调出任务管理器的组合键是,调出任务管理器快捷键
  18. 什么是GP、LP、VC、PE、FOF
  19. 软件工程——成本效益分析
  20. 第一年19元月租100g

热门文章

  1. lol进入服务器后显示3秒白屏,LOL:盘点新客户端出现的BUG,及可行的解决方法...
  2. 编写函数求区间[200,3000]中所有的回文数, 回文数是正读和反读都是一样的数
  3. Appium+python自动化(六)- 连接模拟器并启动淘宝APP(超详解)
  4. 西南大学计算机考研资料汇总
  5. BERT知识蒸馏TinyBERT
  6. 安装OTRS工单管理系统
  7. Flink从入门到真香(12、Flink一大利器-时间窗口)
  8. Checking Table 设计模式 - 从概念、建模、设计到实现
  9. 第三方支付接口之微信扫码支付
  10. 垃圾邮件分类-朴素贝叶斯算法