上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 42 下一页
摘要: 题意:给定的这些点是否有一个对称中心。PS:我写得有点啰嗦。。就是把小的x和大的x进行匹配。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const double eps = 1e-8; 7 const int maxn = 10005; 8 9 struct Point{ 10 double x,y; 11 }; 12 Point pnt1[ maxn ],pnt2[ maxn ]; 13 Point cc; 14 15 int cmp1( Point a,Point b ){ 16 ... 阅读全文
posted @ 2013-08-23 23:00 xxx0624 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 题意简单。询问n个人的宗教关系。 1 #include 2 3 const int maxn = 50005; 4 5 int fa[ maxn ]; 6 int vis[ maxn ]; 7 8 void init( int n ){ 9 for( int i=1;i<=n;i++ )10 {fa[i] = i;vis[i] = 0;}11 }12 int find( int x ){13 if( x==fa[x] )14 return x;15 return fa[x] = find( fa[x] );16 }17 void u... 阅读全文
posted @ 2013-08-23 21:54 xxx0624 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 疾速优化+hash存边 3 题意:给定一个包含N(1 ≤ N ≤ 10,000)个顶点的无向完全图,图中的顶点从1到N依次标号。从这个图中去掉M(0 ≤ M ≤ 1,000,000)条边,求最后与顶点1联通的顶点的数目 4 思路(BFS):从顶点1开始不断扩展,广度优先搜索所有的与当前扩展点联通的顶点。开始每次都要判断所有的顶点是否与cur相连, 5 若相连则push,反之跳过。 6 */ 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 ... 阅读全文
posted @ 2013-08-22 17:06 xxx0624 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 线段树+扫描线+离散化 3 求多个矩形的面积 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 using namespace std; 15 const int maxn = 105; 16 const int maxm = 210; 17 struct SegTree{ 18 int l,r; 19 int cover; 20 double L_val,R_val... 阅读全文
posted @ 2013-08-22 15:45 xxx0624 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 见代码。 1 /* 2 线段树+Lazy 3 题意:有一面墙,被等分为1QW份,一份的宽度为一个单位宽度。 4 现在往墙上贴N张海报,每张海报的宽度是任意的,但是必定是单位宽度的整数倍,且 10 #include 11 #include 12 #include 13 #include 14 #include 15 #include 16 #include 17 #include 18 #include 19 using namespace std; 20 typedef long long int64; 21 //typedef __int64 int64; 22 typedef pa... 阅读全文
posted @ 2013-08-22 15:44 xxx0624 阅读(414) 评论(0) 推荐(0) 编辑
摘要: ubuntu 和 win7 远程登陆:第一种(通过win7自带的远程桌面来连接ubuntu)1. windows7配置 我的电脑-》属性-》远程设置。-----允许远程连接2. ubuntu配置终端-》输入命令:$sudoapt-getinstallxrdp装完后再输入$sudoapt-getins... 阅读全文
posted @ 2013-08-22 12:58 xxx0624 阅读(716) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一个01矩阵。T个询问,每次询问大矩阵中是否存在这个特定的小矩阵。 1 /* 2 64位的位运算!!! 3 题意: 4 给定一个01矩阵。T个询问,每次询问大矩阵中是否存在这个特定的小矩阵。 5 (64位记录状态!!!) 6 */ 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15 #include 16 #include 17 using namespace std; 18 typedef long long int64; 1... 阅读全文
posted @ 2013-08-21 15:32 xxx0624 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 简单的字典树 1 /* 2 字典树 3 构造字典树。注意初始化! 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15 using namespace std; 16 typedef long long int64; 17 //typedef __int64 int64; 18 typedef pair PII; 19 #define MP(a,b) make_pair((a),(b))... 阅读全文
posted @ 2013-08-19 19:13 xxx0624 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 模拟题 1 /* 2 模拟 3 注意:相同一边的车有先后顺序! 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 #include12 #include13 #include14 #include15 using namespace std;16 typedef long long int64;17 //typedef __int64 int64;18 typedef pair PII;19 #define MP(a,b) make_pair((a),(b)) 20 const int maxn = 阅读全文
posted @ 2013-08-19 17:44 xxx0624 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 最小生成树 1 /* 2 prim 3 题意:给定一些点,一些卫星,一个卫星能连接两个点,点和点之间通信有一定的距离限制。 4 问能使得所有的点联通的最小距离。 5 */ 6 #include 7 #include 8 #include 9 #include10 #include11 #include12 #include13 #include14 #include15 #include16 using namespace std;17 typedef long long int64;18 //typedef __int64 int64;19 typedef pair PII;20 #defi 阅读全文
posted @ 2013-08-19 16:37 xxx0624 阅读(339) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 42 下一页