摘要: A.跑步 二分枚举距离,然后构图用并查集判联通数量是否大与等于N,时间复杂度是 Nlog(N),因为所给坐标较大,注意求解距离时强制转换,防止溢出~View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<algorithm>#include<math.h>using namespace std;const int N = 510;const double esp = 1e-8;int n, m, st[N], rank[N];double dis[ 阅读全文
posted @ 2013-03-19 21:12 yefeng1627 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 官方解题报告http://blog.watashi.ws/1515/zojmonthly1010/A题 签到题,╮(╯▽╰)╭,因为 int -> char* 错了一次,还是很粗心。View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<string>using namespace std;const int N = 101100;char str[N];bool isch( char ch ){ if( (ch>='a'& 阅读全文
posted @ 2013-03-19 21:05 yefeng1627 阅读(236) 评论(0) 推荐(0) 编辑
摘要: ACows and Primitive Roots 原根,目前只有暴力求解,看了百度百科才知道。因为 x < p, 且 p <= 2000View Code #include<stdio.h>#include<stdlib.h>int p;int pow( int x, int n ){ int res = 1; while( n ){ if( n&1 ) res = (res*x)%p; x = x*x%p; n >>= 1; } return res;}bool legal( int x ){ if( pow( x... 阅读全文
posted @ 2013-03-19 12:50 yefeng1627 阅读(258) 评论(0) 推荐(0) 编辑

Launch CodeCogs Equation Editor