人生列车

follow on!success!

导航

2014年7月27日 #

Primes on Interval

摘要: AC代码:#include#include#include#includeusingnamespacestd;constintmaxn=1001000;#defineinf(1ans)ans=tmp;tmp=p[s+k-1]-a+1;if(tmp>ans)ans=tmp;for(inti=s;i+k... 阅读全文

posted @ 2014-07-27 21:21 tianxia2s 阅读(208) 评论(0) 推荐(0) 编辑

1305: Substring

摘要: #include #include#includeusing namespace std;#define maxn 10100#define cls(x) memset(x, 0, sizeof(x))//好了,感觉上面的这个变得更加的牛逼了,直接是让大家看起来是像调用了一个函数的样子,然后就得到了... 阅读全文

posted @ 2014-07-27 15:14 tianxia2s 阅读(120) 评论(0) 推荐(0) 编辑

2014年7月24日 #

HDU1272 小希的迷宫 并查集

摘要: 参考网址:http://blog.sina.com.cn/s/blog_6827ac4a0100nyjy.html解题思路:由于这里出现的数字不一定连续的数字都会出现,所以设一个mark来标记数字是否出现过。每次输入一对数字的关系则进行查找根结点的函数,即:if(aa==bb){flag=1;}如果... 阅读全文

posted @ 2014-07-24 16:23 tianxia2s 阅读(179) 评论(0) 推荐(0) 编辑

1213 How Many Tables 简单的并查集问题

摘要: my code:#include #include #includeusing namespace std;int find(int num,int A []){while(num!=A[num])//{ num = A[num];return num;}//bool follow(int a... 阅读全文

posted @ 2014-07-24 11:56 tianxia2s 阅读(164) 评论(0) 推荐(0) 编辑

2014年7月23日 #

POJ 3090 Visible Lattice Points 欧拉函数

摘要: #include #include using namespace std;//点(x,y)可见当且仅当x,y互质,那么我仅仅只要知道int euler(int x){// 就是公式 int i, res=x,tmp; tmp= (int)sqrt(x * 1.0) + 1; fo... 阅读全文

posted @ 2014-07-23 15:50 tianxia2s 阅读(128) 评论(0) 推荐(0) 编辑