题目链接:http://poj.org/problem?id=2236

思路很简单,傻逼的我输出写成了FALL,然后遍历的时候for循环写错了,还好很快我就Debug出来了。

#include <stdio.h>

struct Point
{
int x,y;
} points[]; int father[];
bool vis[]= {false}; int Find_Set (int x)
{
if(x!=father[x])
father[x] = Find_Set(father[x]);
return father[x];
} int main()
{ int N,d;
scanf("%d%d",&N,&d); for(int i=; i<=N; i++)
father[i] = i; for(int i=; i<=N; i++)
scanf("%d%d",&points[i].x,&points[i].y);
getchar(); char ch;
while(scanf("%c",&ch)!=EOF)
{
getchar();
int n,m;
if(ch=='O')
{
scanf("%d",&n);
getchar();
vis[n] = true; for(int i=; i<=N; i++)
{
if(i!=n&&vis[i])
{
int tx = points[n].x - points[i].x;
int ty = points[n].y - points[i].y;
if(tx*tx+ty*ty<=d*d)
{
int fx = Find_Set(i);
int fy = Find_Set(n); if(fx!=fy)
father[fy] = fx;
}
}
}
}
else
{
scanf("%d%d",&n,&m);
getchar(); int fx,fy;
fx = Find_Set(n);
fy = Find_Set(m);
if(fx!=fy)
printf("FAIL\n");
else printf("SUCCESS\n"); }
} return ;
}

最新文章

  1. SCOI2010游戏
  2. 3 WPF之从0开始学习XMAL
  3. Python之路----数据类型
  4. MultipeerConnectivity
  5. 2014第35周三jquery最近用到的内容总结
  6. 收集整理的非常有用的PHP函数
  7. &lt;转载&gt; UE4的Actor类C++简单尝试
  8. Win32程序框架
  9. base64详解及实现
  10. 查找第K小的数 BFPRT算法
  11. 混合模式为什么成为占有率最高的app开发技术
  12. watch解放你的双手
  13. RMAN入门——简介
  14. ES6 Module的语法
  15. hdu 1698 线段树(成段替换 区间求和)
  16. hanlp中文自然语言处理的几种分词方法
  17. Ubuntu13.04下Eclipse中文乱码解决
  18. JS拖拽事件
  19. Android演示Stack(课下作业)
  20. linux多线程同步

热门文章

  1. eclipse中找不到base64包的解决方法
  2. 单点登录-JWT(Json Web Tokens)
  3. (转)Linux系统排查4——网络篇
  4. jemeter排至数据库时报:Access denied for user &#39;root&#39;@&#39;localhost&#39; (using password:YES) 解决方案
  5. C语言测试int型数据的最大值最小值
  6. eclipse中使用git下载项目
  7. http method and status code
  8. 使用InstallShield打包VS程序
  9. 文件监控只FileSystemWatcher控件
  10. c# 字符串大小写混合转换