【POJ 1942】 Paths on a Grid
来源:互联网 发布:淘宝售后客服工作规范 编辑:程序博客网 时间:2024/05/16 12:03
【POJ 1942】 Paths on a Grid
一共要走m+n步 C(n,m+n) 即可求出方案数 为防止超时 要始终保证n最小 为了防止WA 要用unsigned并且 n||m。。。坑点就是n m 可能有一个为0 也要输出。。。
代码如下:
<span style="font-size:14px;">#include <iostream>#include <cstdio>using namespace std;#define ll long longint main(){ ll n,m,ans,i,t; while(~scanf("%lld %lld",&n,&m) && n || m) { if(m < n) { t = n; n = m; m = t; } ++m; ans = 1; for(i = 1; i <= n; ++i,++m) { ans = (ans*m)/i; } printf("%lld\n",ans); } return 0;}</span>
0 0
- poj 1942 Paths on a Grid
- POJ 1942 Paths on a Grid
- POJ 1942 Paths on a Grid .
- POJ 1942 Paths on a Grid
- poj 1942 Paths on a Grid
- POJ 1942 Paths on a Grid
- POJ 1942 Paths on a Grid
- POJ 1942 Paths on a Grid
- POJ 1942 Paths on a Grid
- POJ 1942 Paths on a Grid
- poj 1942Paths on a Grid
- POJ 1942--Paths on a Grid
- poj 1942 Paths on a Grid
- POJ 1942 Paths on a Grid (水题)
- POJ 1942:Paths on a Grid
- POJ 1942 Paths on a Grid
- 【POJ 1942】 Paths on a Grid
- Paths on a Grid(POJ--1942
- Python函数式编程指南(三):迭代器
- iframe自适应高度(兼容多种浏览器)
- Java中由substring方法引发的内存泄漏
- 在Centos下安装部署SVN方法
- JavaScript学习笔记之类型之间的判断比较
- 【POJ 1942】 Paths on a Grid
- HDU 2594 — Simpsons’ Hidden Talents
- http_build_query
- CSS 超出隐藏实现限制字数的功能代码(多浏览器)
- 关于MD5值加密算法
- Python 使用正则表达式 - 2
- IE获取文件目录下的文件列表及ActiveXObject IE设置
- 分享git使用
- 数据结构实验图论:基于邻接矩阵/邻接表的广度优先搜索遍历