摘要: 题目链接题意:在一个n*n的棋盘上放m个车,使得各个车之间不相互攻击。有多少种放法?组合数学解法 现在n行中选出m行,C(n,m),再在n列中选出m列随便放A(n,m),答案为C(n,m)*A(n,m)。#include #include typedef __int64 LL;LL A(int n, int m){ LL ans = 1; for (int i = n-m+1; i <= n; i++) ans *= i; return ans;}LL C(int n, int m){ LL ans = 1; for (int i = 1; i <=... 阅读全文
posted @ 2013-05-06 20:28 xindoo 阅读(133) 评论(0) 推荐(0) 编辑