摘要: 正则表达式使用单个字符串来描述、匹配一系列符合某个句法规则的字符串。在很多文本编辑器里,正则表达式通常被用来检索、替换那些符合某个模式的文本。许多编程语言都支持正则表达式,C#也不例外,下面让我们来初探正则表达式。首先是元字符,即在正则表达式中具有特殊意义的一些专用字符,可以用一个或一组元字符来代替... 阅读全文
posted @ 2015-04-19 18:29 hxy_has_been_used 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 两道题基本一样。判断两个数是否互质即可。设x为走的步数,m为间距,则需要判断 x * m % n 是否可以充满0到n - 1的闭区间。互质的话,存在逆元,所以一定可以。hdu 1222: 1 #include 2 using namespace std; 3 4 int gcd( int a, ... 阅读全文
posted @ 2015-04-19 17:13 hxy_has_been_used 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 骑士巡游找最短路。单向bfs: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 8; 7 const int M = N * N; 8 int step[N][N]; 9 int dir[N]... 阅读全文
posted @ 2015-04-19 15:45 hxy_has_been_used 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题目大意:FJ要去抓牛...思路:bfs即可 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 100001; 7 bool visit[N]; 8 9 struct Node10 {11 ... 阅读全文
posted @ 2015-04-19 15:01 hxy_has_been_used 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 题目描述:如标题思路:一比一比根号二咯 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 4; 7 8 struct Node 9 {10 int x, y, z;11 } node... 阅读全文
posted @ 2015-04-19 00:16 hxy_has_been_used 阅读(346) 评论(0) 推荐(0) 编辑