hdu 6114
来源:互联网 发布:丁丁软件 编辑:程序博客网 时间:2024/06/05 23:02
题目传送门:
假设矩阵的长边为n,短边为m,那么按题意摆放最多能放m个車,题目就转化为我们从1~n里边随意选择m个数,然后把它们按前后顺序挨个放在1~m即可
ac代码:
#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int maxn=1e9+7;long long c[1005][1005];void init(){ memset(c,0,sizeof(c)); c[0][0]=c[1][0]=c[1][1]=1; for(int i=2;i<=1005;i++) { c[i][0]=c[i][i]=1; for(int j=1;j<i;j++) c[i][j]=(c[i-1][j]+c[i-1][j-1])%maxn; }}int main(){ int t; cin>>t; init(); while(t--) { int n,m; scanf("%d%d",&n,&m); printf("%lld\n",c[max(m,n)][min(n,m)]); } return 0;}
阅读全文
0 0
- hdu 6114
- HDU 6114
- hdu 6114 Chess
- 【HDU 6114 Chess】
- HDU 6114 Chess
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- HDU
- Hdu
- hdu
- Android 6.0 解决recyclerview 在 scrollview 中不能全部显示,高度不正常的问题
- IO和NIO
- 批量下载matplotlib网站实例源码python脚本
- asp.net mvc 自定义路由及其伪静态设置
- 多线程
- hdu 6114
- 我的第一篇博客
- Codeforces 839C-Journey
- FPGA源同步输入时序约束(一)
- SpringSecurity【注解对方法的权限控制+@PreAuthorize无效】
- PHP之is_string
- 关于树的存储表示的说明
- React Native入门与实战
- 使用leakCanary