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. 2 pyspark学习----基本操作

    1 spark的python环境部署可以参照上面一篇哟.http://www.cnblogs.com/lanjianhappy/p/8705974.html 2 pyspark的基本操作. # cod ...

  2. PHP实用小程序(三)

    <HTML> <HEAD> <TITLE>给数组增加元素</TITLE> </HEAD> <? $Cities[] = "& ...

  3. Gym 100851A Adjustment Office (思维)

    题意:给定一个 n*n 的矩阵,然后有 m 个询问,问你每一行或者每一列总是多少,并把这一行清空. 析:这个题不仔细想想,还真不好想,我们可以根据这个题意,知道每一行或者每一列都可以求和公式来求,然后 ...

  4. 简单运行Lua代码

    http://blog.csdn.net/hamenny/article/details/4420522

  5. FLINK源代码调试方式

    此文已由作者岳猛授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 第一种,直接通过IDEA WINDOWS调试 前提是Flink所有依赖已经导入,直接在Test中打断点,然后直 ...

  6. 坑暗花明:又遇 .NET Core 中 System.Data.SqlClient 查询缓慢的问题

    之前发布过一篇博文 下单快发货慢:一个 JOIN SQL 引起 SqlClient 读取数据慢的奇特问题,当时遇到的问题是从 SQL Server 2008 R2 中查询获取 100 条记录竟然耗时 ...

  7. 小程序地区时间自定义选择器 picker

    进入微信公众平台小程序开发文档搜索 picker 点进去后下滑,点击在开发者工具中预览即可

  8. Unity中HideInInspector和SerializeField

    http://blog.sina.com.cn/s/blog_697b1b8c0102uxvn.html Unity会自动为Public变量做序列化,序列化的意思是说再次读取Unity时序列化的变量是 ...

  9. IT兄弟连 JavaWeb教程 Servlet会话跟踪 Session优缺点

    ●  数据存储在服务器,安全. ●  session能保存Object类型数据,也就是说能存储任意数据. ●  可存储的数据大小,理论上是无限制的. ●  因为数据存储在服务器端,当用户比较多时,会占 ...

  10. load View 流程 程序启动流程

    基本流程: loadView / nib文件  来加载view到内存 -> viewDidLoad 函数进一步初始化这些view -> 内存不足时, 调用viewDidUnload 函数释 ...