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. Flutter实战视频-移动电商-25.列表页_使用Provide控制子类-1

    25.列表页_使用Provide控制子类-1 主要是二级分类的UI布局 1分15秒 生成我们的右侧动态类 定义list变量 开始写里面的子项,把每一个小的写了 再拼成一个大的 这样我们的小类就写完了 ...

  2. mysql的权限问题SQLException: access denied for @'localhost' (using password: no)

    遇到了 SQLException: access denied for  @'localhost' (using password: no) 解决办法   grant all privileges o ...

  3. 使用JavaScript选择GridView行的方法汇总

    一行: e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.gvUsers, &q ...

  4. 深入探究Java中equals()和==的区别是什么

    目录 相等判断符"==" "=="判断基本类型数据 "=="判断引用类型数据 相等判断方法equals() 思考:为什么要设计equals( ...

  5. lightoj 1027【数学概率】

    #include <bits/stdc++.h> using namespace std; typedef long long LL; const int N=1e2+10; int ma ...

  6. 实现easyui combobox中textField字段的拼接

    开发过程中遇到这样的一个需求: 从后台得到的两个字段aa.bb拼接为一个字段aabb显示在easyui combobx的下拉选项中. 实现方法: 利用formatter属性定义如何呈现行: 页面代码: ...

  7. MQ简介1

    站在巨人的肩膀上 关于消息队列的使用 一.消息队列概述消息队列中间件是分布式系统中重要的组件,主要解决应用解耦,异步消息,流量削锋等问题,实现高性能,高可用,可伸缩和最终一致性架构.目前使用较多的消息 ...

  8. 51Nod 1134 最长递增子序列(动态规划O(nlogn))

    #include <iostream> #include <algorithm> #include <stdio.h> #define MAXN 50010 usi ...

  9. 虚拟机无法分配内存 virtual memory exhausted: Cannot allocate memory

    1.内存交换空间(swap)的构建 安装Linux时一定需要的两个分区:根目录和swap(内存交换空间). swap的功能:在应付物理内存不足的情况下所造成的内存扩展记录的功能. 物理内存不足的时候, ...

  10. iOS 更改状态栏、导航栏颜色的几种方法

    ios上状态栏 就是指的最上面的20像素高的部分状态栏分前后两部分,要分清这两个概念,后面会用到: 前景部分:就是指的显示电池.时间等部分:背景部分:就是显示黑色或者图片的背景部分: (一)设置sta ...