Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equals the distance between i and k (the order of the tuple matters).

Find the number of boomerangs. You may assume that n will be at most 500 and coordinates of points are all in the range [-10000, 10000] (inclusive).

Example:

Input:
[[0,0],[1,0],[2,0]]
 
Output:
2
 
Explanation:
The two boomerangs are [[1,0],[0,0],[2,0]] and [[1,0],[2,0],[0,0]]

思路:对于每一个点P,求它和其它点的距离,若存在n个点与P的距离为d,则可构成n*(n-1)个三元组(n大于1)。利用C++ 的map,依次遍历每一个点。

最新文章

  1. 【原】AFNetworking源码阅读(六)
  2. TortoiseSvn客户端出现Http state 405 'Method Not Allowed' 的解决办法
  3. C# ToString("x2")的理解
  4. Oracle中用户的基本操作
  5. 用distinct在MySQL中查询多条不重复记录值[转]
  6. 几种进入mysql的方法
  7. 结队开发项目——基于Android的无线点餐系统——NABC模型
  8. Linux操作系统启动流程浅析
  9. POJ 3281 Dining 网络流最大流
  10. Foundation与coreFoundation的相互转换
  11. phpcms栏目调用
  12. pat 1062. Talent and Virtue (25)
  13. Eclipse用法和技巧五:生成说明文档2
  14. Android开发之异步具体解释(二)之AsyncTask
  15. 洛谷P2845-Switching on the Lights 开关灯
  16. CountDownLatch和CyclicBarrier模拟同时并发请求
  17. AI-认证
  18. JavaScript中对象分类
  19. CodeChef Arithmetic Progressions
  20. 黄聪:JQUERY的datatables插件,Date range filter时间段筛选功能

热门文章

  1. R语言统计分析技术研究——岭回归技术的原理和应用
  2. Redis客户端管理工具,状态监控工具
  3. php使用openssl加密数据
  4. SQL手动注入解析
  5. [leetcode-625-Minimum Factorization]
  6. 【LeetCode】66. Plus One
  7. IOS 状态栏(UIStatusBar)
  8. accp8.0转换教材第1章多线程理解与练习
  9. 用maven创建工程
  10. 改变图像,运用match方法判断