poj1942 Paths on a Grid
来源:互联网 发布:java 时间格式 cst 编辑:程序博客网 时间:2024/05/16 08:48
题意很好理解,只是数据有点大,是用排列组合的知识,为了减小数据量,阶乘采用间接求得!注意下就可以了,还有对double数据要采用四舍五入的方法。
#include<iostream>#include<cstdio>#include<cmath>using namespace std;void fun(unsigned int n,unsigned int m){double s=1.0,t;unsigned int i,b;b=n>m?m:n;for(i=1; i<=b; i++){t=((1.0*(n+m+1-i))/(1.0*(b+1-i)));s=s*t ;}s+=0.5;printf("%u\n",(unsigned int)s);}int main(){unsigned int n,m;while(1){ scanf("%u%u",&n,&m);if(n==0 && m==0)break;fun(n,m);}return 0;}
- poj1942 Paths on a Grid
- poj1942 Paths on a Grid
- poj1942 Paths on a Grid 【排列组合】
- poj1942 Paths on a Grid(组合数)
- POJ1942 Paths on a Grid (组合数学)
- POJ1942——Paths on a Grid
- poj1942 Paths on a Grid
- poj1942--Paths on a Grid(组合篇4)
- poj1942——Paths on a Grid(求阶乘)
- poj1942——Paths on a Grid//大数的C(n,m)
- Paths on a Grid
- Paths on a Grid
- Paths on a Grid
- pku1942 Paths on a Grid
- pku1942-Paths on a Grid
- poj 1942 Paths on a Grid
- POJ 1942 Paths on a Grid
- POJ 1942 Paths on a Grid .
- Ubuntu下vi编辑器使用难解决
- hdu1455
- poj 1273 Drainage Ditches(最大费用流+最短增广路径算法)
- 【有趣的面试题】有人邀请ABCDEF六人参加一项会议
- A. Nearly Lucky Number
- poj1942 Paths on a Grid
- poj2038
- android数据存储二
- Bazaar版本管理工具 Ubuntu
- VxWorks Booting Process
- 常引用、常对象、对象的常成员
- EAS 生成子系统树后有些单据还是没有出现在配置信息中
- EAS 分录表头合并
- 反编译java的switch, if else 语句