题意 : 给你一个n*m的矩形格子,问你从左下角那个点到右上角那个点的走法有多少种,只能往后或者往上走雷到爆的一道水题,只是因为WA了10几次,到最后居然发现n和m同时为0才可以break。。。无语了,太水了我,,,
#include <stdio.h>
#include <iostream>
using namespace std;
#define LL __int64
void solve(LL n,LL m)
{
double tot = n+m;
if(n > m)
n = m;
// printf("%I64d %I64d\n", tot,n);
LL sum = n;
double ans = 1;
while(sum--)
{
// printf("%lld ", n);
ans *= tot;
ans /= n;
// printf("%.0lf\n",ans);
tot--;
n--;
}
printf("%.lf\n", ans);
}
int main()
{
LL n,m;
while(cin>>n>>m)
{
if(n==0 && m==0)
break;
solve(n,m);
}
return 0;
}