Educational Codeforces Round 11 _D
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的更多相关文章
- Educational Codeforces Round 11 C. Hard Process 前缀和+二分
题目链接: http://codeforces.com/contest/660/problem/C 题意: 将最多k个0变成1,使得连续的1的个数最大 题解: 二分连续的1的个数x.用前缀和判断区间[ ...
- Educational Codeforces Round 11
A. Co-prime Array http://codeforces.com/contest/660/problem/A 题意:给出一段序列,插进一些数,使新的数列两两成互质数,求插最少的个数,并输 ...
- 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 ...
- Educational Codeforces Round 11 D. Number of Parallelograms 暴力
D. Number of Parallelograms 题目连接: http://www.codeforces.com/contest/660/problem/D Description You ar ...
- Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process 题目连接: http://www.codeforces.com/contest/660/problem/C Description You are given an a ...
- Educational Codeforces Round 11 B. Seating On Bus 水题
B. Seating On Bus 题目连接: http://www.codeforces.com/contest/660/problem/B Description Consider 2n rows ...
- 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 ...
- 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 ...
- Educational Codeforces Round 11 A
A. Co-prime Array time limit per test 1 second memory limit per test 256 megabytes input standard in ...
随机推荐
- dockerfile创建镜像(二)
ENTRYPOINT 两种格式: ENTRYPOINT [“executable”, “param1”, “param2”] ENTRYPOINT command param1 param2 (she ...
- python 之队列
进程和线程模块下都有队列类. 线程队列: # 后进先出->堆栈 q=queue.LifoQueue(3) # 优先级队列,数字越小优先级越高 q=queue.PriorityQueue(3) 进 ...
- java 大数详细讲解
介绍 java中用于操作大叔的类主要有俩种 第一个是BigInteger,代表大整数.第二个是BigDecimal,代表大浮点数.两种类的操作方法类似,所以我们只讲解BigInterger的用法 基本 ...
- 483. Smallest Good Base
For an integer n, we call k>=2 a good base of n, if all digits of n base k are 1. Now given a str ...
- css div平移淡入淡出
<!DOCTYPE html> <html> <head> <style> div { width:100px; height:100px; backg ...
- 集中化管理平台 — Ansible 详解
# Ansible 简介 Ansible 类似于Saltstack,是一种集成IT系统的配置管理.应用部署.执行特定任务的开源平台.Ansible基于Python语言实现,由Paramiko和PyYA ...
- Java之多线程同步基础
java学习的道路上呢总有一些麻烦的东西需要花费一些时间去理解,比如个人认为不好搞的多线程. 线程是并列运行的 因为是并列运行,所以有时候会发生资源抢占,从而导致参数变化; 比如酱紫 package ...
- 计算机网络自顶向下方法第2章-应用层(application-layer).1
2.1 应用层协议原理 2.1.1网络应用程序体系结构 1)在客户-服务器体系结构 (client-server architecture)中,有一个总是打开的主机称为服务器,它服务于来自许多其他称为 ...
- 给mysql默认root用户设置密码
情况1:如果忘记了 MySQL 的 root 密码,可以用以下方法重新设置: 情况2:添加了phpmyadmin,登录时使用mysql的用户密码登录,但phpmyadmin不能使用空密码登录,即为 ...
- python使用rabbitmq实现简单的消息转发
准备: 1.下载elang语言的支持环境http://www.erlang.org/download.html (rabbitmq使用它开发的) 2.下载rabbitmq软件http://www.ra ...