标签:factor div nbsp lan Plan span etc bsp amp
int factorial(int n){ int ret=1; while(n) ret*=n--; return ret; } int paintingPlan(int n, int k){ if (k==0 || k==n*n) return 1; int blank=n*n-k,ret=0,val,i; for (i=1; i<=n && i<=blank; i++) if (blank%i == 0 && blank/i <= n) ret += (factorial(n)/(factorial(blank/i)*factorial(n-blank/i))) * (factorial(n)/(factorial(i)*factorial(n-i))); return ret; }
标签:factor div nbsp lan Plan span etc bsp amp
原文地址:https://www.cnblogs.com/ganxiang/p/13936496.html