cf869C The Intriguing Obsession
题解:
因为太菜了,没想出正解。
容易发现,三行间两两是独立的,最后乘起来就好了。
而两两间其实不难算,昨晚一直想dp去了,于是荒废半小时。
直接组合数学:
∑i=0min(n,m)CinCimi!\sum^{min(n,m)}_{i=0}C_n^iC_m^ii!
最后乘起来。
好像不怎么难,但我太菜了。
code:
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#define LL long long
using namespace std;
const LL mod=998244353;
LL sum[5010],ny[5010];
LL a,b,c;
LL quick(LL a,LL b)
{LL ans=1;while(b){if(b&1) (ans*=a)%=mod;(a*=a)%=mod;b>>=1;}return ans;
}
void pre()
{sum[1]=1;ny[1]=1;ny[0]=1;sum[0]=1;for(LL i=2;i<=5000;i++){sum[i]=sum[i-1]*i%mod;ny[i]=quick(sum[i],mod-2);}
}
LL C(LL n,LL m){return sum[m]*ny[m-n]%mod*ny[n]%mod;}
LL solve(LL n,LL m)
{LL ans=0;LL t=min(n,m);for(LL i=0;i<=t;i++)ans=(ans+C(i,n)*C(i,m)%mod*sum[i]%mod)%mod;return ans;
}
int main()
{scanf("%lld %lld %lld",&a,&b,&c);pre();printf("%lld",solve(a,b)*solve(a,c)%mod*solve(b,c)%mod);
}
cf869C The Intriguing Obsession相关推荐
- CF869C The Intriguing Obsession 题解
此题算法:模拟. 题目概述 由题意可得,此题是让我们连接三种不同颜色的点, 要求同颜色的点距离大于等于 3 (每条边的距离为 1 ), 任意两个点至多连 1 条边, 问有多少种连接方案(答案需取模). ...
- CF869C The Intriguing Obsession
题目链接:http://codeforces.com/contest/869/problem/C 题目大意: 有三种颜色(红蓝紫)的点 \(a, b, c\) 个,这些点之间可以用距离为\(1\)的边 ...
- CF869C:C. The Intriguing Obsession(组合数)
C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input s ...
- codeforces 869C The Intriguing Obsession 组合数学,逆元
codeforces 869C The Intriguing Obsession 题意 在三种颜色的群岛之间建造桥梁,每一种颜色分别有a,b,c 限制条件 1 相同颜色的岛之间的距离 d >= ...
- The Intriguing Obsession
C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input s ...
- C. The Intriguing Obsession
C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input s ...
- Codefrces 869C. The Intriguing Obsession
C. The Intriguing Obsession - This is not playing but duty as allies of justice, Nii-chan! - Not all ...
- C. The Intriguing Obsession[组合数学]
C. The Intriguing Obsession time limit per test 1 second memory limit per test 256 megabytes input s ...
- Codeforces Round #439 C.The Intriguing Obsession(组合数学)
C. The Intriguing Obsession time limit per test1 secondmemory limit per test256 megabytesinputstanda ...
最新文章
- Windows C++中__declspec(dllexport)的使用
- python装饰器函数-python函数装饰器
- [转]C#遍历局域网的几种方法及比较
- 机器学习知识点(七)决策树学习算法Java实现
- VIJOS 1052贾老二算算术 (高斯消元)
- 计算机符号的英文名,【常见符号英文名称】英文名称
- oracle loop index,oracle index 聚集因子
- springboot单例模式注入对象_Spring 中经典的 9 种设计模式,打死也要记住啊!
- jdk1.8对synchronized锁的优化
- 爬虫数据executemany插入_金融数据的获取——一个爬虫的简单例子
- Linux或者Mac解压乱码问题
- 退休后,你是因为什么还要继续工作?做原来的工作还是做新工作?
- 实习生的一点建议和感悟
- 什么叫别让孩子输在起跑线上?! - 电子产品已成儿童“多动症”诱因
- 腾讯云TCA运维考试题
- apple watch更新系统时出现红色感叹号解决方法
- 【DSP开发】帮您快速入门 TI 的 Codec Engine
- java线程池功能_Java线程池总结
- 9017R单节锂电池线性充电管理 IC
- MySQL之——MySQL5.6 my.cnf 参数说明(附上自己服务器上真实配置文件)
热门文章
- 关于ERP系统提前期运算逻辑的三点介绍(转)
- lua对接bmob数据库
- android画布裁剪圆角,Android 视图圆角化处理方案
- CSDN成立20周年书法作品集
- 华为 dis ip routing-table怎么看?
- AI创作教程之如何使用简单的 Web API 和 GPU 支持在 Docker 中运行 Stable Diffusion,在 45 秒内启动用于 Stable Diffusion的 Web API
- 嵌入式学习笔记(一)嵌入式操作系统测试
- 类型多样的终结者游戏成套模型素材,速来收藏
- matlab 期权图,如何使用matlab计算期权价格
- python案例2-简易网吧系统