标签:
#include<stdio.h>//光棍节的快乐(451) long long f(int x) { long long res=1,i; for(i=1;i<=x;i++){ res=res*i; } return res; } long long g(int x) { if(x==2)return 1; else if(x==3)return 2; else return (x-1)*(g(x-1)+g(x-2)); } int main() { long long m,n,t,res,i; while(scanf("%lld%lld",&m,&n)!=EOF){ t=m-n; res=f(m)/(f(t)*f(n)); printf("%lld\n",res*g(n)); } return 0; }
标签:
原文地址:http://www.cnblogs.com/minimalism/p/4537596.html