摘要: 复杂度O(min(k,n-k)^2)#define LL long long LL gcd(LL a, LL b) { return b? gcd(b, a%b): a;}LL C(int n, int k) { vector<int> vn; k=min(n-k,k); for(int i=n-k+1; i<=n; ++i) { vn.push_back(i); } for(int i=2; i<=k; ++i) { int t = i; for(int j=0; j<vn.size(); ++j) { ... 阅读全文
posted @ 2012-05-12 22:23 HaoHua_Lee 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 模拟题,很暴力的水过,不过可以用并查集优化注意两个重点是可以的#include<iostream>#include<cstdio>#include<cmath>#include<cstring>using namespace std;const int N = 500;int ar[N][N];struct Point{ int x,y;}a,b,ra,rb;bool ok(Point a,Point b){ if(a.x==b.x) { for(int i=min(a.y,b.y);i<=max(a.y,b.y);i++) if(ar[a 阅读全文
posted @ 2012-05-12 13:29 HaoHua_Lee 阅读(181) 评论(0) 推荐(0) 编辑