poj942Paths on a Grid
http://poj.org/problem?id=1942
建立数学模型 C(a,b);
此题就是考察排列组合 就是数据卡的紧 wa了两次
1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 unsigned long long int n,m,s,a,b; 6 unsigned long long int i,j; 7 while(cin>>n>>m) 8 { 9 if(n==0&&m==0) break; 10 if(n<m) 11 { 12 unsigned long long int t=n; 13 n=m; 14 m=t; 15 } 16 s=1;a=n+m;b=m; 17 for(i=a-b+1,j=1;i<=a,j<=b;i++,j++) 18 { 19 s=s*i/j; 20 } 21 cout<<s<<endl; 22 23 } 24 return 0; 25 }