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 ofa, b andc 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 length1. 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 isat 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 modulo998 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 a, b 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, modulo998 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 bridges that can possibly be built, and no setup of bridges violates the restrictions. Thus the answer is23 = 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.

题意:

解:选出两个颜色 每次从他的个数中选i个(0=<i<=(min(x,y))) 然后两者相乘 再乘以i的阶乘(两列数组合的方法数)

之所以选相同的个数 是因为选多了连不上等于不选 而且不能一个颜色同时连两个其他相同的颜色 所以方法数是阶乘 将三组点对之间的所有方法数相乘就是结果

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <math.h>
#include <bitset>
#include <algorithm>
#include <climits>
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
typedef long long LL;
const LL mod = 998244353;
map<int,int>q;
LL a[N], b[N];
LL quick(LL r,LL n)
{LL x=1;while(n){if(n&1) x=x*r%mod;r=r*r%mod;n>>=1;}return x;
}LL cal(LL x,LL y)
{LL ans=0;for(LL i=0;i<=x&&i<=y;i++){ans=(ans+a[x]*b[i]%mod*b[x-i]%mod*a[y]%mod*b[i]%mod*b[y-i]%mod*a[i])%mod;}return ans%mod;
}int main()
{a[0]=1,b[0]=1;for(LL i=1;i<=5000;i++){a[i]=a[i-1]*i%mod;b[i]=quick(a[i],mod-2);}LL x, y, z;scanf("%I64d %I64d %I64d", &x, &y, &z);LL ans=1;ans=ans*cal(x,y)%mod;ans=ans*cal(x,z)%mod;ans=ans*cal(z,y)%mod;cout<<ans%mod<<endl;return 0;
}

codeforces contest 869 problem C(组合数)相关推荐

  1. Codeforces Contest 1092 problem D1 Great Vova Wall (Version 1)

    Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, ...

  2. Codeforces Contest 1081 problem D Maximum Distance —— 并查集

    Chouti was tired of the tedious homework, so he opened up an old programming problem he created year ...

  3. Codeforces Contest 1138 problem B Circus —— 死亡1700,暴力

    Polycarp is a head of a circus troupe. There are n - an even number - artists in the troupe. It is k ...

  4. Codeforces Contest 1110 problem E Magic Stones —— 更改算式

    Grigory has n magic stones, conveniently numbered from 1 to n. The charge of the i-th stone is equal ...

  5. codeforces contest 1166 E. The LCMs Must be Large---思维

    题目链接:https://codeforces.com/contest/1166/problem/E 题解: 代码: #include<bits/stdc++.h> using names ...

  6. CodeForces - 29A Spit Problem【水题】

    题目链接:https://codeforces.com/contest/29/problem/A #include <iostream> #include <cstdio> # ...

  7. 2021 ICPC Asia Regionals Online Contest (II) Problem G. Limit

    The 2021 ICPC Asia Regionals Online Contest (II) Problem G. Limit 在欧教的指导下,复习了下高数知识,写下了这题的题解- 做这道题之前, ...

  8. CodeForces 991E Bus Number DFS+ 组合数

    CodeForces 991E Bus Number DFS+ 组合数 题目大意:给定一个数字,数字里出现的每一个数,都至少要用一个,问能组成多少个新数,不加前导零. input: 2028 outp ...

  9. 2018 Multi-University Training Contest 3 Problem F. Grab The Tree 【YY+BFS】

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6324 Problem F. Grab The Tree Time Limit: 2000/1000 MS ...

最新文章

  1. 【高并发、高性能、高可用】系统设计经验分享!
  2. 主宰这个世界的10大算法
  3. .Net学习笔记----2015-07-10(GDI绘图)
  4. 函数-函数进阶-装饰器流程分析
  5. C# 8中的Async Streams
  6. 【秒懂】号称最为简明实用的Django上手教程
  7. codeigniter:去掉 URL 中的 index.php
  8. asp.net分页方法
  9. Activiti接受任务(receiveTask)
  10. 导入了jar包但是无法import方法
  11. 从拉新、促活/留存和营收说起,做运营到底是在做什么?
  12. 旅行商问题近似解——NP完全问题
  13. mzy git学习,删除文件(三)
  14. Highcharts的spline示例
  15. 自行车电动自行车|GCC认证办理流程
  16. 经典梯度下降、随机梯度下降、批量梯度下降是个啥?
  17. Computer:字符编码(ASCII编码/GBK编码/BASE64编码/UTF-8编码)的简介、案例应用(python中的编码格式及常见编码问题详解)之详细攻略
  18. 使用ASP和ASP.NET来创建文件夹和文件。
  19. 平台的核心交互与基础角色——互联网平台建设系列...
  20. 【开说正事】猿宵节灯谜,你知多少?

热门文章

  1. 微信小程序一秒学会制作table表格
  2. GEE|假彩色目视解译山东省玉米、水稻、小麦等样本集制作代码
  3. 笔记本没有计算机和网络怎么回事,华为笔记本连wifi无internet怎么办?华为笔记本电脑怎么连不上网?...
  4. 「hdu6608」Fansblog 威尔逊定理
  5. linux驱动学习的磕磕碰碰
  6. JVM--Jit学习
  7. 资深美女基金经理首次分享基金知识,好评如潮!!!
  8. 处理深度学习中数据集不平衡问题方法汇总
  9. Netty——ByteBuffer(ByteBuffer消息粘包、半包示例)
  10. python系列tkinter之pack布局、place布局和grid布局