http://codeforces.com/contest/660/problem/D

这个题据说是很老的题了 然而我现在才知道做法

用map跑了1953ms;

题目大意 给你n个点的坐标 求这些点能组成多少个位置不同的四边形

我们统计两个点之间的中点坐标  假如有n对点的中点重合 那么我们就知道这里面有(n-1)*n/2个平行四边形

就这样搞喽。

PS:说实话typedef pair<double,double> pdd; 这语句让我想到了骚猪PDD 笑死了。

#include<cstdio>
#include<map>
//#include<bits/stdc++.h>
#include<vector>
#include<stack>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<cstdlib>
#include<climits>
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<double,double> pdd;
typedef __int64 int64;
const ll mood=1e9+;
const int64 Mod=;
const double eps=1e-;
const int N=2e7+;
const int MAXN=;
inline void rl(ll&num){
num=;ll f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<='')num=num*+ch-'',ch=getchar();
num*=f;
}
inline void ri(int &num){
num=;int f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<='')num=num*+ch-'',ch=getchar();
num*=f;
}
double a[MAXN],b[MAXN];
int main()
{
int n;
map<pdd,int>mp;
ri(n);
for(int i=;i<n;i++)
{
scanf("%lf%lf",&a[i],&b[i]);
}
pdd x;
for(int i=;i<n;i++)
{
for(int j=i+;j<n;j++)
{
x.first=(a[i]+a[j])/;
x.second=(b[i]+b[j])/;
mp[x]++;
}
}
ll ans=;
map<pdd,int>::iterator it;
for(it=mp.begin();it!=mp.end();++it)
{
int tem=it->second;
pdd t=it->first;
ans+=(tem-)*tem/;
}
cout<<ans<<endl;
return ;
}

一个古老的题

Educational Codeforces Round 11 _D的更多相关文章

  1. Educational Codeforces Round 11 C. Hard Process 前缀和+二分

    题目链接: http://codeforces.com/contest/660/problem/C 题意: 将最多k个0变成1,使得连续的1的个数最大 题解: 二分连续的1的个数x.用前缀和判断区间[ ...

  2. Educational Codeforces Round 11

    A. Co-prime Array http://codeforces.com/contest/660/problem/A 题意:给出一段序列,插进一些数,使新的数列两两成互质数,求插最少的个数,并输 ...

  3. Educational Codeforces Round 11 E. Different Subsets For All Tuples 动态规划

    E. Different Subsets For All Tuples 题目连接: http://www.codeforces.com/contest/660/problem/E Descriptio ...

  4. Educational Codeforces Round 11 D. Number of Parallelograms 暴力

    D. Number of Parallelograms 题目连接: http://www.codeforces.com/contest/660/problem/D Description You ar ...

  5. Educational Codeforces Round 11 C. Hard Process 二分

    C. Hard Process 题目连接: http://www.codeforces.com/contest/660/problem/C Description You are given an a ...

  6. Educational Codeforces Round 11 B. Seating On Bus 水题

    B. Seating On Bus 题目连接: http://www.codeforces.com/contest/660/problem/B Description Consider 2n rows ...

  7. Educational Codeforces Round 11 A. Co-prime Array 水题

    A. Co-prime Array 题目连接: http://www.codeforces.com/contest/660/problem/A Description You are given an ...

  8. Educational Codeforces Round 11 B

    Description Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of th ...

  9. Educational Codeforces Round 11 A

    A. Co-prime Array time limit per test 1 second memory limit per test 256 megabytes input standard in ...

随机推荐

  1. 【Linux学习】Linux文件系统4—Linux文件硬链接与软连接

    Linux文件系统4-Linux文件硬链接与软连接 inode:索引节点 (连接文件)link 一.文件硬链接 1.Linux文件系统中,inode只相同的文件是硬链接文件 2.不同文件名,inode ...

  2. beans.xml中的头部配置

    Spring配置文件beans.xml头部配置解释 关于在beans.xml要使用哪些功能,官网上已经提供了每个功能说明和标准的头文件信息,当我们在开发使用时要哪些功能,都可以上官网去定位. http ...

  3. Linux下新建一个站点

    Apache+nagix使用Lnmpa创建一个新的站点 我们在部署服务器的时候通常会遇到需要分域名和分应用部署,那么如何通过Apache+nagix创建一个新的站点服务呢 LNMPA这种架构有什么优势 ...

  4. 聊聊IT行业加班的问题

    IT行业(包括互联网行业)是快速发展的行业,有时候一家公司同时可能要开发多个项目,并发进行,在公司开发人员相对固定的情况下,要想在指定的时间内完成项目谈何容易. 项目多.任务重.需求的不明确.技术难关 ...

  5. 删除node_modul模块

    npm安装rimraf ,npm版本号要是低于5.x.x 具体不记得了,不然就安装不了这个工具 npm install rimraf -g 然后: rimraf node_modules 在这里学到的 ...

  6. Android开发实践:掌握Camera的预览方向和拍照方向

    http://ticktick.blog.51cto.com/823160/1592267?utm_source=tuicool&utm_medium=referral Android的Cam ...

  7. unity3d 在UGUI中制作自适应调整大小的滚动布局控件

    http://blog.csdn.net/rcfalcon/article/details/43459387 在游戏中,我们很多地方需要用到scroll content的概念:我们需要一个容器,能够指 ...

  8. Mol Cell Proteomics. |陈洁| 整合鸟枪法蛋白质组学中鉴定和定量的错误率

    大家好,本周分享的是发表在MCP上的一篇关于鸟枪蛋白质组学中的错误率的文章,题目是Integrated identification and quantification error probabil ...

  9. ADO学途 two day

    代码实现的参照性在学习程序中占了关键比重,最基本的都一直无法运行成功,那就无法深入 研究.实现winfrom功能的要点之一实践中获取原理:不清楚代码的一些原理,即使copy过来,大多也 存无法运行的情 ...

  10. 5 天 4000 star 的一个爆款开源项目

    今天早上起来浏览 GitHub 的时候,在周热门趋势排行榜上看到了这么一个开源项目,仅仅 5 天时间,爬到了周排行榜的第一名的位置.而在每天的排行榜上,今天一早也高高位居排行榜的第二位. 这个开源项目 ...