【组合数】51Nod 1627 瞬间移动
来源:互联网 发布:特朗普的对华政策 知乎 编辑:程序博客网 时间:2024/05/18 05:12
题面在这里
考虑枚举移动的步数
那么答案就是
示例程序:
#include<cstdio>typedef long long ll;const int maxn=100005,tt=1e9+7;int n,m;ll fac[maxn],inv[maxn],ans;ll power(ll a,int b){ ll w=a,res=1; while (b){ if (b&1) res=res*w%tt; w=w*w%tt; b>>=1; } return res;}void make(){ fac[0]=1;inv[0]=1; for (int i=1;i<=100000;i++) fac[i]=fac[i-1]*i%tt,inv[i]=power(fac[i],tt-2);}inline ll C(int y,int x){ return fac[x]*inv[y]%tt*inv[x-y]%tt;}int main(){ scanf("%d%d",&n,&m); if (n==2||m==2) return printf("1"),0; make();ans=0; for (int i=1;i<n&&i<m;i++) (ans+=C(i-1,n-2)*C(i-1,m-2)%tt)%=tt; printf("%lld",ans); return 0;}
阅读全文
1 0
- 【组合数】51Nod 1627 瞬间移动
- 51nod 1627 瞬间移动 组合数
- 51nod 1627 瞬间移动 组合数取模
- 51nod 1627 瞬间移动【组合数学】
- 51nod 瞬间移动 (组合数学)
- 51nod 1627 瞬间移动
- 51nod 1627 瞬间移动
- HDU 5698 瞬间移动 (组合数 + 阶乘逆元)
- [hdu5698]: 瞬间移动(两种方法求组合数)
- HDU 5698 瞬间移动【组合数+逆元】
- 51node-1627 瞬间移动
- 51nod 1677 treecnt【树,组合数】
- 51nod 1677 treecnt 组合数
- 51nod 1453 抽彩球(组合数)
- Hdu 5698 瞬间移动【组合+逆元】
- hdu 5698 瞬间移动 -- (大组合数取模)
- 大组合数取模hdu5698 瞬间移动
- 【组合数学】HDU5698[瞬间移动]题解
- CAESARII 5.1 无限使用功能\
- PhpMyAdmin 配置文件现在需要一个短语密码的解决方法
- 描述函数栈帧的调用过程
- 贝叶斯规则
- c 程序 自己学习的一些出错点
- 【组合数】51Nod 1627 瞬间移动
- C++:补齐函数编写递归函数计算x的y次幂(hhhh函数 !头疼!)
- 什么是JVM、Java编译器和Java解释器
- idea 激活
- JAVA 记录小组信息输出
- Java导入Excel中的数据,及一些Excel的逻辑判断
- MySql 的批量操作
- muduo网络库学习(五)服务器监听类Acceptor及Tcp连接TcpConnection的建立与关闭
- bootstrap的模态弹出框modal在有滚动条的页面被隐藏了的解决方法