Codeforces Round #439 (Div. 2) C
来源:互联网 发布:windows 98 iso 编辑:程序博客网 时间:2024/06/05 00:16
题意
你有三种颜色的点,每一种有a,b,c个
然后你可以连边
但是同一颜色的最短距离不能小于3
问你有多少种不同的连边方案
题解
容易发现,其实三行里面两两都是独立的
因为我们只要不要一个点 同时连向颜色相同的两个点就好了
因此我们可以将两两之间可行的方案乘起来就是答案了
于是这里有组合数学的方法:
这就是两列之间了
然后把方案乘起来
CODE:
#include<cstdio>#include<iostream>#include<algorithm>using namespace std;const int MOD=998244353;typedef long long LL;LL a,b,c;LL tot1=0,tot2=0,tot3=0;LL get (LL x,LL y){ if (y==0) return 1; if (y==1) return x; LL lalal=get(x,y/2);lalal=lalal*lalal%MOD; if (y%2!=0) lalal=lalal*x%MOD; return lalal;}LL shen (LL x,LL y)//这两个东西 { LL ooo=1; LL now=1; for (LL u=1;u<=min(x,y);u++) { now=now*(x-u+1)%MOD*(y-u+1)%MOD*get(u,MOD-2)%MOD; ooo=(ooo+now)%MOD; } return ooo;}int main(){ scanf("%I64d%I64d%I64d",&a,&b,&c); printf("%I64d\n",shen(a,b)*shen(b,c)%MOD*shen(a,c)%MOD); return 0;}
阅读全文
0 0
- Codeforces Round #439 (Div. 2) C
- 【codeforces】Codeforces Round #370 (Div. 2) C
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div.2)
- Codeforces Round #439 (Div.2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2) A-C题解
- Codeforces Round #439 (Div. 2) C. The Intriguing Obsession
- Codeforces Round #439 (Div. 2) C. The Intriguing Obsession
- Codeforces Round #439 (Div. 2) A-C题解
- Codeforces Round #439 (Div. 2) C. The Intriguing Obsession dp
- Codeforces Round #439 (Div. 2) C. The Intriguing Obsession
- Codeforces Round #439 (Div. 2) C. The Intriguing Obsession 数学
- Codeforces Round #439 (Div. 2) C. The Intriguing Obsession(dp)
- Codeforces Round #439 (Div. 2) 869 C. The Intriguing Obsession
- 1051. 复数乘法 (15)
- optimizers总结
- 键盘快捷键
- 洛谷 3375 KMP模板 KMP
- QFileSystemWatcher 使用
- Codeforces Round #439 (Div. 2) C
- hash
- MPEG-CDVA标准的特征提取(除深度学习)& 视频匹配 & 视频检索
- 50. Pow(x, n)
- 将链表L就地逆置,即利用原表各结点的空间实现逆置
- CF869 E. The Untended Antiquity
- 【Java学习3.5.2】强制类型转换
- k组合生成问题-非递归
- Mapper动态代理方式